From c6980ec2d852e3a5163b2bcb1a5a6b24c87b69ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 25 Apr 2017 11:21:22 +0200 Subject: [PATCH] Remove C++98 backcompat from toString --- include/internal/catch_tostring.h | 41 +++-------------------------- include/internal/catch_tostring.hpp | 4 --- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 21ab99a0..f72eeca3 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -20,13 +20,9 @@ #include "catch_objc_arc.hpp" #endif -#ifdef CATCH_CONFIG_CPP11_TUPLE #include -#endif -#ifdef CATCH_CONFIG_CPP11_IS_ENUM #include -#endif namespace Catch { @@ -52,14 +48,10 @@ std::string toString( char value ); std::string toString( signed char value ); std::string toString( unsigned char value ); -#ifdef CATCH_CONFIG_CPP11_LONG_LONG std::string toString( long long value ); std::string toString( unsigned long long value ); -#endif -#ifdef CATCH_CONFIG_CPP11_NULLPTR std::string toString( std::nullptr_t ); -#endif #ifdef __OBJC__ std::string toString( NSString const * const& nsstring ); @@ -72,26 +64,6 @@ namespace Detail { extern const std::string unprintableString; - #if !defined(CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK) - struct BorgType { - template BorgType( T const& ); - }; - - struct TrueType { char sizer[1]; }; - struct FalseType { char sizer[2]; }; - - TrueType& testStreamable( std::ostream& ); - FalseType testStreamable( FalseType ); - - FalseType operator<<( std::ostream const&, BorgType const& ); - - template - struct IsStreamInsertable { - static std::ostream &s; - static T const&t; - enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) }; - }; -#else template class IsStreamInsertable { template @@ -104,9 +76,8 @@ namespace Detail { public: static const bool value = decltype(test(0))::value; }; -#endif -#if defined(CATCH_CONFIG_CPP11_IS_ENUM) + template::value > @@ -125,19 +96,14 @@ namespace Detail { ); } }; -#endif + template struct StringMakerBase { -#if defined(CATCH_CONFIG_CPP11_IS_ENUM) template static std::string convert( T const& v ) { return EnumStringMaker::convert( v ); } -#else - template - static std::string convert( T const& ) { return unprintableString; } -#endif }; template<> @@ -202,7 +168,6 @@ std::string toString( std::vector const& v ) { } -#ifdef CATCH_CONFIG_CPP11_TUPLE // toString for tuples namespace TupleDetail { @@ -242,7 +207,7 @@ struct StringMaker> { return os.str(); } }; -#endif // CATCH_CONFIG_CPP11_TUPLE + namespace Detail { template diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index e61191b9..f20c41a2 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -169,7 +169,6 @@ std::string toString( unsigned char value ) { return toString( static_cast( value ) ); } -#ifdef CATCH_CONFIG_CPP11_LONG_LONG std::string toString( long long value ) { std::ostringstream oss; oss << value; @@ -184,13 +183,10 @@ std::string toString( unsigned long long value ) { oss << " (0x" << std::hex << value << ')'; return oss.str(); } -#endif -#ifdef CATCH_CONFIG_CPP11_NULLPTR std::string toString( std::nullptr_t ) { return "nullptr"; } -#endif #ifdef __OBJC__ std::string toString( NSString const * const& nsstring ) {