about summary refs log tree commit diff
path: root/src/libutil/ref.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-03T12·45+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T09·01+0200
commitdfebfc835f7b8156a559314bcd1ecff739c14fd1 (patch)
tree94843083056eabd89f3892e71f4cc6173b1189d8 /src/libutil/ref.hh
parent80f739b571771b56b9930fbf1ca3e3a4128b46cb (diff)
Add a copyStorePath() utility function
Diffstat (limited to 'src/libutil/ref.hh')
-rw-r--r--src/libutil/ref.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/ref.hh b/src/libutil/ref.hh
index 9f5da09152c9..85afa28119a9 100644
--- a/src/libutil/ref.hh
+++ b/src/libutil/ref.hh
@@ -28,6 +28,13 @@ public:
             throw std::invalid_argument("null pointer cast to ref");
     }
 
+    explicit ref<T>(T * p)
+        : p(p)
+    {
+        if (!p)
+            throw std::invalid_argument("null pointer cast to ref");
+    }
+
     T* operator ->() const
     {
         return &*p;