From fd205fb6f8edc73a0d867a6dfc5a34737bae6bb9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 11 Feb 2016 15:32:48 +0100 Subject: ref: Add cast operator --- src/libutil/types.hh | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/libutil/types.hh') diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 23eb5251209e..0eae46c5fe93 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -134,16 +134,18 @@ public: return p; } + template + operator ref () + { + return ref((std::shared_ptr) p); + } + private: template friend ref make_ref(Args&&... args); - template - friend ref - make_ref(Args&&... args); - }; template @@ -154,13 +156,4 @@ make_ref(Args&&... args) return ref(p); } -template -inline ref -make_ref(Args&&... args) -{ - auto p = std::make_shared(std::forward(args)...); - return ref(p); -} - - } -- cgit 1.4.1