From dfebfc835f7b8156a559314bcd1ecff739c14fd1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 May 2016 14:45:50 +0200 Subject: Add a copyStorePath() utility function --- src/libutil/ref.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libutil/ref.hh') diff --git a/src/libutil/ref.hh b/src/libutil/ref.hh index 9f5da0915..85afa2811 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 * p) + : p(p) + { + if (!p) + throw std::invalid_argument("null pointer cast to ref"); + } + T* operator ->() const { return &*p; -- cgit v1.2.3