mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
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:
parent
3819df6e37
commit
f9c47dd63f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user