aboutsummaryrefslogtreecommitdiffstats
path: root/include/gsl/gsl
diff options
context:
space:
mode:
authorRian Quinn <rianquinn@gmail.com>2017-03-09 13:42:18 -0700
committerNeil MacIntosh <neilmac@microsoft.com>2017-03-09 12:42:18 -0800
commitf9c47dd63fe25cc216294fbe7e2fbe4f9a302ca3 (patch)
tree157c4934220f02c0d10ea2187656242e4ed90750 /include/gsl/gsl
parent3819df6e378ffccf0e29465afe99c3b324c2aa70 (diff)
downloadplatform_external_Microsoft-GSL-f9c47dd63fe25cc216294fbe7e2fbe4f9a302ca3.tar.gz
platform_external_Microsoft-GSL-f9c47dd63fe25cc216294fbe7e2fbe4f9a302ca3.tar.bz2
platform_external_Microsoft-GSL-f9c47dd63fe25cc216294fbe7e2fbe4f9a302ca3.zip
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
Diffstat (limited to 'include/gsl/gsl')
-rw-r--r--include/gsl/gsl8
1 files changed, 8 insertions, 0 deletions
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 <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;