From f9c47dd63fe25cc216294fbe7e2fbe4f9a302ca3 Mon Sep 17 00:00:00 2001 From: Rian Quinn Date: Thu, 9 Mar 2017 13:42:18 -0700 Subject: [PATCH] add gsl::not_null operator<< (#464) * add gsl::not_null operator<< Hippomocks, which is a popular mocking engine for C++ uses operator<< on pointers and gets confused about gsl::not_null not having this operator. * Update gsl --- include/gsl/gsl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/gsl/gsl b/include/gsl/gsl index c620a09..26742be 100644 --- a/include/gsl/gsl +++ b/include/gsl/gsl @@ -25,6 +25,7 @@ #include // span #include // zstring, string_span, zstring_builder... #include +#include #if defined(_MSC_VER) && _MSC_VER < 1910 #pragma push_macro("constexpr") @@ -109,6 +110,13 @@ private: T ptr_; }; +template +std::ostream& operator<<(std::ostream& os, const not_null& val) +{ + os << val.get(); + return os; +} + // more unwanted operators template std::ptrdiff_t operator-(const not_null&, const not_null&) = delete;