diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/ref.hh | 7 |
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; |