From 5dcb2af5213ae132b7531e45e7f93258cc33ffd8 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 21 Mar 2025 17:00:47 +0200 Subject: [PATCH] Do not include or declare operator<< when BOOST_NO_IOSTREAM is defined. Fixes #43. --- include/boost/assert/source_location.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/boost/assert/source_location.hpp b/include/boost/assert/source_location.hpp index c6eae32..3c2d60e 100644 --- a/include/boost/assert/source_location.hpp +++ b/include/boost/assert/source_location.hpp @@ -9,11 +9,14 @@ #include #include -#include #include #include #include +#if !defined(BOOST_NO_IOSTREAM) +#include +#endif + #if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L # include #endif @@ -132,12 +135,16 @@ public: } }; +#if !defined(BOOST_NO_IOSTREAM) + template std::basic_ostream & operator<<( std::basic_ostream & os, source_location const & loc ) { os << loc.to_string(); return os; } +#endif + } // namespace boost #if defined(BOOST_DISABLE_CURRENT_LOCATION)