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
This commit is contained in:
Rian Quinn 2017-03-09 13:42:18 -07:00 committed by Neil MacIntosh
parent 3819df6e37
commit f9c47dd63f

View File

@ -25,6 +25,7 @@
#include <gsl/span> // span
#include <gsl/string_span> // zstring, string_span, zstring_builder...
#include <memory>
#include <iostream>
#if defined(_MSC_VER) && _MSC_VER < 1910
#pragma push_macro("constexpr")
@ -109,6 +110,13 @@ private:
T ptr_;
};
template <class T>
std::ostream& operator<<(std::ostream& os, const not_null<T>& val)
{
os << val.get();
return os;
}
// more unwanted operators
template <class T, class U>
std::ptrdiff_t operator-(const not_null<T>&, const not_null<U>&) = delete;