Added compiler feature suppression macros

_NO_ forms to disable detection of features - particularly C++11 features.
Also removed SFINAE detection (and use in tostring)
This commit is contained in:
Phil Nash
2015-06-30 08:41:55 +01:00
parent 21f7ef6fdc
commit 7ab3b5aefb
4 changed files with 59 additions and 127 deletions

View File

@@ -9,7 +9,6 @@
#define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
#include "catch_common.h"
#include "catch_sfinae.hpp"
#include <sstream>
#include <iomanip>
@@ -68,32 +67,13 @@ namespace Detail {
extern std::string unprintableString;
// SFINAE is currently disabled by default for all compilers.
// If the non SFINAE version of IsStreamInsertable is ambiguous for you
// and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
#ifdef CATCH_CONFIG_SFINAE
template<typename T>
class IsStreamInsertableHelper {
template<int N> struct TrueIfSizeable : TrueType {};
template<typename T2>
static TrueIfSizeable<sizeof((*(std::ostream*)0) << *((T2 const*)0))> dummy(T2*);
static FalseType dummy(...);
public:
typedef SizedIf<sizeof(dummy((T*)0))> type;
};
template<typename T>
struct IsStreamInsertable : IsStreamInsertableHelper<T>::type {};
#else
struct BorgType {
template<typename T> BorgType( T const& );
};
struct TrueType { char sizer[1]; };
struct FalseType { char sizer[2]; };
TrueType& testStreamable( std::ostream& );
FalseType testStreamable( FalseType );
@@ -106,8 +86,6 @@ namespace Detail {
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
};
#endif
#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
template<typename T,
bool IsEnum = std::is_enum<T>::value