about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02T11·33+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02T14·02+0200
commit812c0dfbe24c8fe93992f77abbf1e5a975ea42f4 (patch)
treed69bcc87ce446f270f6b01f7069655223d52a626 /src/libutil
parentf2682e6e18a76ecbfb8a12c17e3a0ca15c084197 (diff)
Allow setting the state directory as a store parameter
E.g. "local?store=/tmp/store&state=/tmp/var".
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/ref.hh17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libutil/ref.hh b/src/libutil/ref.hh
index 85afa28119a9..0be2a7e74ae0 100644
--- a/src/libutil/ref.hh
+++ b/src/libutil/ref.hh
@@ -45,19 +45,30 @@ public:
         return *p;
     }
 
-    operator std::shared_ptr<T> ()
+    operator std::shared_ptr<T> () const
+    {
+        return p;
+    }
+
+    std::shared_ptr<T> get_ptr() const
     {
         return p;
     }
 
     template<typename T2>
-    ref<T2> cast()
+    ref<T2> cast() const
     {
         return ref<T2>(std::dynamic_pointer_cast<T2>(p));
     }
 
     template<typename T2>
-    operator ref<T2> ()
+    std::shared_ptr<T2> dynamic_pointer_cast() const
+    {
+        return std::dynamic_pointer_cast<T2>(p);
+    }
+
+    template<typename T2>
+    operator ref<T2> () const
     {
         return ref<T2>((std::shared_ptr<T2>) p);
     }