diff --git a/src/catch2/catch_tostring.cpp b/src/catch2/catch_tostring.cpp index 3a63a598..4eeabbae 100644 --- a/src/catch2/catch_tostring.cpp +++ b/src/catch2/catch_tostring.cpp @@ -201,11 +201,6 @@ std::string StringMaker::convert(unsigned long long value) { return rss.str(); } - -std::string StringMaker::convert(bool b) { - return b ? "true" : "false"; -} - std::string StringMaker::convert(signed char value) { if (value == '\r') { return "'\\r'"; @@ -230,10 +225,6 @@ std::string StringMaker::convert(unsigned char c) { return ::Catch::Detail::stringify(static_cast(c)); } -std::string StringMaker::convert(std::nullptr_t) { - return "nullptr"; -} - int StringMaker::precision = 5; std::string StringMaker::convert(float value) { diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index 77f05fe0..04cd84df 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -239,7 +239,10 @@ namespace Catch { template<> struct StringMaker { - static std::string convert(bool b); + static std::string convert(bool b) { + using namespace std::string_literals; + return b ? "true"s : "false"s; + } }; template<> @@ -257,7 +260,10 @@ namespace Catch { template<> struct StringMaker { - static std::string convert(std::nullptr_t); + static std::string convert(std::nullptr_t) { + using namespace std::string_literals; + return "nullptr"s; + } }; template<> @@ -512,18 +518,14 @@ namespace Catch { template struct ratio_string { - static std::string symbol(); + static std::string symbol() { + Catch::ReusableStringStream rss; + rss << '[' << Ratio::num << '/' + << Ratio::den << ']'; + return rss.str(); + } }; -template -std::string ratio_string::symbol() { - Catch::ReusableStringStream rss; - rss << '[' << Ratio::num << '/' - << Ratio::den << ']'; - return rss.str(); -} - - template <> struct ratio_string { static std::string symbol() { return "a"; }