diff options
| author | Martin Hořeňovský | 2020-02-03 20:48:44 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-02-03 20:53:36 +0100 |
| commit | bce5b364d39add56025713a01a5af9f331d3ce0e (patch) | |
| tree | 972a8f752bcb6f9ae461f871f86050ff90cff58f /src | |
| parent | 34bc56340dbb22c11d5bae8dc6018df53626281e (diff) | |
| download | catch3-bce5b364d39add56025713a01a5af9f331d3ce0e.tar.gz | |
Unconditionally provide <chrono> StringMakers
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/catch_tostring.cpp | 11 | ||||
| -rw-r--r-- | src/catch2/catch_tostring.h | 19 |
2 files changed, 9 insertions, 21 deletions
diff --git a/src/catch2/catch_tostring.cpp b/src/catch2/catch_tostring.cpp index 913cd22b..0e3abbde 100644 --- a/src/catch2/catch_tostring.cpp +++ b/src/catch2/catch_tostring.cpp @@ -12,10 +12,6 @@ # pragma clang diagnostic ignored "-Wglobal-constructors" #endif -// Enable specific decls locally -#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -#endif #include <catch2/catch_tostring.h> #include <catch2/catch_interfaces_config.h> @@ -250,13 +246,6 @@ std::string StringMaker<double>::convert(double value) { return fpToString(value, precision); } -std::string ratio_string<std::atto>::symbol() { return "a"; } -std::string ratio_string<std::femto>::symbol() { return "f"; } -std::string ratio_string<std::pico>::symbol() { return "p"; } -std::string ratio_string<std::nano>::symbol() { return "n"; } -std::string ratio_string<std::micro>::symbol() { return "u"; } -std::string ratio_string<std::milli>::symbol() { return "m"; } - } // end namespace Catch #if defined(__clang__) diff --git a/src/catch2/catch_tostring.h b/src/catch2/catch_tostring.h index 57d43a6d..b5339688 100644 --- a/src/catch2/catch_tostring.h +++ b/src/catch2/catch_tostring.h @@ -351,13 +351,12 @@ namespace Catch { ////////////////////////////////////////////////////// // Separate std-lib types stringification, so it can be selectively enabled -// This means that we do not bring in +// This means that we do not bring in their headers #if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) # define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER # define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER # define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER # define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER #endif @@ -532,7 +531,6 @@ namespace Catch { } // namespace Catch // Separate std::chrono::duration specialization -#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) #include <ctime> #include <ratio> #include <chrono> @@ -552,29 +550,31 @@ std::string ratio_string<Ratio>::symbol() { << Ratio::den << ']'; return rss.str(); } + + template <> struct ratio_string<std::atto> { - static std::string symbol(); + static std::string symbol() { return "a"; } }; template <> struct ratio_string<std::femto> { - static std::string symbol(); + static std::string symbol() { return "f"; } }; template <> struct ratio_string<std::pico> { - static std::string symbol(); + static std::string symbol() { return "p"; } }; template <> struct ratio_string<std::nano> { - static std::string symbol(); + static std::string symbol() { return "n"; } }; template <> struct ratio_string<std::micro> { - static std::string symbol(); + static std::string symbol() { return "u"; } }; template <> struct ratio_string<std::milli> { - static std::string symbol(); + static std::string symbol() { return "m"; } }; //////////// @@ -647,7 +647,6 @@ struct ratio_string<std::milli> { } }; } -#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER #include <catch2/catch_interfaces_registry_hub.h> |