diff options
| author | Martin Hořeňovský | 2021-06-20 09:53:50 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-06-20 19:14:56 +0200 |
| commit | 849002aec0271b0a8356162134ea78731e84454a (patch) | |
| tree | 61d0452c468d595fb94037d15585193bbdd110d9 /src | |
| parent | 4eb9af51af825af4ce880f0bf6df4dad6ac45870 (diff) | |
| download | catch3-849002aec0271b0a8356162134ea78731e84454a.tar.gz | |
Move specialization for global op<< to the proper place
In v2 it was placed in a very central header due to the way it was
stitched together. Now that we don't do that, we can move it to the
proper place, removing the potential for confusion given that the
original header was split apart and renamed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/catch_tostring.hpp | 9 | ||||
| -rw-r--r-- | src/catch2/internal/catch_source_line_info.hpp | 10 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index 8fbe67a6..00893c46 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -28,9 +28,18 @@ #pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless #endif +// We need a dummy global operator<< so we can bring it into Catch namespace later +struct Catch_global_namespace_dummy{}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); + namespace Catch { + // Bring in global namespace operator<< for ADL lookup in + // `IsStreamInsertable` below. + using ::operator<<; + namespace Detail { + constexpr StringRef unprintableString = "{?}"_sr; //! Encases `string in quotes, and optionally escapes invisibles diff --git a/src/catch2/internal/catch_source_line_info.hpp b/src/catch2/internal/catch_source_line_info.hpp index bd828fad..c6b98195 100644 --- a/src/catch2/internal/catch_source_line_info.hpp +++ b/src/catch2/internal/catch_source_line_info.hpp @@ -11,10 +11,6 @@ #include <cstddef> #include <iosfwd> -// We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); - namespace Catch { struct SourceLineInfo { @@ -33,12 +29,6 @@ namespace Catch { friend std::ostream& operator << (std::ostream& os, SourceLineInfo const& info); }; - - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; } #define CATCH_INTERNAL_LINEINFO \ |