aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/ref.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02 13:33:49 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02 16:02:48 +0200
commit812c0dfbe24c8fe93992f77abbf1e5a975ea42f4 (patch)
treed69bcc87ce446f270f6b01f7069655223d52a626 /src/libutil/ref.hh
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/ref.hh')
-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 85afa2811..0be2a7e74 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);
}