about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-11T14·32+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-11T14·32+0100
commitfd205fb6f8edc73a0d867a6dfc5a34737bae6bb9 (patch)
treefa51b5b2a3e7e676a4bb468104e0c60bcdbc73e8 /src/libutil
parentad0dc41899cafb8ee8afc73856d3a86ec3fa0240 (diff)
ref<T>: Add cast operator
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/types.hh19
1 files changed, 6 insertions, 13 deletions
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<typename T2>
+    operator ref<T2> ()
+    {
+        return ref<T2>((std::shared_ptr<T2>) p);
+    }
+
 private:
 
     template<typename T2, typename... Args>
     friend ref<T2>
     make_ref(Args&&... args);
 
-    template<typename T2, typename T3, typename... Args>
-    friend ref<T2>
-    make_ref(Args&&... args);
-
 };
 
 template<typename T, typename... Args>
@@ -154,13 +156,4 @@ make_ref(Args&&... args)
     return ref<T>(p);
 }
 
-template<typename T, typename T2, typename... Args>
-inline ref<T>
-make_ref(Args&&... args)
-{
-    auto p = std::make_shared<T2>(std::forward<Args>(args)...);
-    return ref<T>(p);
-}
-
-
 }