mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-16 10:05:39 +02:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user