diff --git a/include/gsl/pointers b/include/gsl/pointers index 874583d..f7c3885 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -20,11 +20,15 @@ #include // for Ensures, Expects #include // for forward -#include // for ptrdiff_t, nullptr_t, ostream, size_t +#include // for ptrdiff_t, nullptr_t, size_t #include // for shared_ptr, unique_ptr #include // for hash #include // for enable_if_t, is_convertible, is_assignable +#if !defined(GSL_NO_IOSTREAMS) +#include // for ostream +#endif // !defined(GSL_NO_IOSTREAMS) + namespace gsl { @@ -116,12 +120,14 @@ auto make_not_null(T&& t) noexcept { return not_null>>{std::forward(t)}; } +#if !defined(GSL_NO_IOSTREAMS) template std::ostream& operator<<(std::ostream& os, const not_null& val) { os << val.get(); return os; } +#endif // !defined(GSL_NO_IOSTREAMS) template auto operator==(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() == rhs.get())) -> decltype(lhs.get() == rhs.get())