From 18c5255609a558c40dd94069a0bb7c57e014924a Mon Sep 17 00:00:00 2001 From: Kern Handa Date: Mon, 28 Sep 2015 10:03:25 -0700 Subject: [PATCH] not_null and maybe_null_* should have explicit conversion operators. Implicit conversion operators are bad and are also against the guidelines. --- include/gsl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gsl.h b/include/gsl.h index bf3573e..f218239 100644 --- a/include/gsl.h +++ b/include/gsl.h @@ -142,7 +142,7 @@ public: return ptr_; } // the assume() should help the optimizer - operator T() const { return get(); } + explicit operator T() const { return get(); } T operator->() const { return get(); } bool operator==(const T& rhs) const { return ptr_ == rhs; } @@ -258,7 +258,7 @@ public: return ptr_; } - operator T() const { return get(); } + explicit operator T() const { return get(); } T operator->() const { return get(); } private: @@ -328,7 +328,7 @@ public: T get() const { return ptr_; } - operator T() const { return get(); } + explicit operator T() const { return get(); } T operator->() const { return get(); } private: