40#ifndef INCLUDED_GLS_CPP_LANG_SUPPORT_H
41#define INCLUDED_GLS_CPP_LANG_SUPPORT_H
73#if defined( _MSC_VER )
75# define DISTI_HAS_RVAL_REFS
76# define DISTI_HAS_METHOD_OVERRIDE
77# define DISTI_HAS_TYPE_TRAITS
78# define DISTI_HAS_STATIC_ASSERT
81# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
82# define DISTI_HAS_CPP11
85# define DISTI_HAS_USER_DEFINED_LITERALS
87# if _MSC_VER >= 1911 && __cplusplus >= 201402L
88# define DISTI_HAS_NOEXCEPT
89# define DISTI_HAS_DEPRECATED_ATTRIBUTE
90# define DISTI_HAS_CPP14
96#elif defined( __GNUC__ ) && !defined( __clang__ )
98# if __cpp_rvalue_references >= 200610 || ( ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L ) )
99# define DISTI_HAS_RVAL_REFS
101# if __cpp_static_assert >= 200410 && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
102# define DISTI_HAS_STATIC_ASSERT
104# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 9 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
105# define DISTI_HAS_USER_DEFINED_LITERALS
107# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 7 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
108# define DISTI_HAS_METHOD_OVERRIDE
109# define DISTI_HAS_NOEXCEPT
110# define DISTI_HAS_TYPE_TRAITS
111# define DISTI_HAS_CPP11
113# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
114# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
116# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 9 ) ) && __cplusplus >= 201402L
117# define DISTI_HAS_DEPRECATED_ATTRIBUTE
118# define DISTI_HAS_CPP14
124#elif defined( __clang__ )
125# if __has_feature( cxx_rvalue_references )
126# define DISTI_HAS_RVAL_REFS
127# define DISTI_HAS_CPP11
129# if __has_feature( cxx_override_control )
130# define DISTI_HAS_METHOD_OVERRIDE
132# if __has_feature( cxx_noexcept )
133# define DISTI_HAS_NOEXCEPT
135# if __has_feature( cxx_defaulted_functions ) && __has_feature( cxx_deleted_functions )
136# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
138# if __has_feature( cxx_static_assert )
139# define DISTI_HAS_STATIC_ASSERT
141# if __has_feature( cxx_user_literals )
142# define DISTI_HAS_USER_DEFINED_LITERALS
144# if( __clang_major__ > 3 || ( __clang_major__ == 3 && __clang_minor__ >= 4 ) ) && __cplusplus >= 201402L
145# define DISTI_HAS_DEPRECATED_ATTRIBUTE
146# define DISTI_HAS_CPP14
149# define DISTI_HAS_TYPE_TRAITS
157#ifdef DISTI_HAS_CPP14
159# define DISTI_HAS_CPP11
161# define DISTI_HAS_DEPRECATED_ATTRIBUTE
164#ifdef DISTI_HAS_CPP11
166# define DISTI_IF_HAS_CPP11( x ) x
168# define DISTI_IF_HAS_CPP11_ELSE( x, y ) x
171# define DISTI_HAS_RVAL_REFS
173# define DISTI_HAS_METHOD_OVERRIDE
175# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
177# define DISTI_HAS_TYPE_TRAITS
179# define DISTI_HAS_STATIC_ASSERT
185# define DISTI_IF_HAS_CPP11( x )
187# define DISTI_IF_HAS_CPP11_ELSE( x, y ) y
193#if !defined( DISTI_NO_RVAL_REFS ) && defined( DISTI_HAS_RVAL_REFS )
196# define DISTI_RVAL_MOVE( x ) std::move( x )
198# define DISTI_UREF_FORWARD( T, x ) std::forward<T>( x )
200# define DISTI_UREF( T ) T&&
202# define DISTI_IF_HAS_RVAL_REFS( x ) x
204# define DISTI_IF_HAS_RVAL_REFS_ELSE( x, y ) x
206# undef DISTI_HAS_RVAL_REFS
208# define DISTI_RVAL_MOVE( x ) x
210# define DISTI_UREF_FORWARD( T, x ) x
212# define DISTI_UREF( T ) const T&
214# define DISTI_IF_HAS_RVAL_REFS( x )
216# define DISTI_IF_HAS_RVAL_REFS_ELSE( x, y ) y
220#if !defined( DISTI_NO_METHOD_OVERRIDE ) && defined( DISTI_HAS_METHOD_OVERRIDE )
222# define DISTI_METHOD_OVERRIDE override
224# define DISTI_FINAL final
226# undef DISTI_HAS_METHOD_OVERRIDE
228# define DISTI_METHOD_OVERRIDE
234#if !defined( DISTI_NO_NOEXCEPT ) && defined( DISTI_HAS_NOEXCEPT )
236# define DISTI_FUNC_NOEXCEPT noexcept
238# undef DISTI_HAS_NOEXCEPT
240# define DISTI_FUNC_NOEXCEPT
244#if !defined( DISTI_NO_SPECIAL_MEM_FUN_DEL ) && defined( DISTI_HAS_SPECIAL_MEM_FUN_DEL )
246# define DISTI_SPECIAL_MEM_FUN_DELETE = delete
248# undef DISTI_HAS_SPECIAL_MEM_FUN_DEL
250# define DISTI_SPECIAL_MEM_FUN_DELETE
254#if !defined( DISTI_NO_USER_DEFINED_LITERALS ) && defined( DISTI_HAS_USER_DEFINED_LITERALS )
256# define DISTI_IF_HAS_USER_DEFINED_LITERAL( x ) x
258# undef DISTI_HAS_USER_DEFINED_LITERALS
260# define DISTI_IF_HAS_USER_DEFINED_LITERAL( x )
264#if !defined( DISTI_NO_TYPE_TRAITS ) && defined( DISTI_HAS_TYPE_TRAITS )
269# define DISTI_IF_HAS_TYPE_TRAITS_ELSE( x, y ) x
277# define DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO( T, ConvertsTo ) DISTI_STATIC_ASSERT( ( std::is_convertible<T*, ConvertsTo*>::value ), class_does_not_inherit_from_##ConvertsTo );
280# define DISTI_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( std::is_trivially_destructible<T>() )
282# define DISTI_TT_TRUE_TYPE std::true_type
284# define DISTI_TT_FALSE_TYPE std::false_type
286# undef DISTI_HAS_TYPE_TRAITS
291# define DISTI_IF_HAS_TYPE_TRAITS_ELSE( x, y ) y
293# ifndef DOXYGEN_IGNORE
295# define DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO( T, ConvertsTo ) DISTI_STATIC_ASSERT( ( ::disti::_cppLangSupportDetail::is_convertible<T*, ConvertsTo*>::value ), class_does_not_inherit_from_##ConvertsTo )
298# define DISTI_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( ::disti::_cppLangSupportDetail::is_trivially_destructible<T>() )
299# define DISTI_TT_TRUE_TYPE ::disti::_cppLangSupportDetail::true_type
300# define DISTI_TT_FALSE_TYPE ::disti::_cppLangSupportDetail::false_type
307namespace _cppLangSupportDetail
323 template<
class T,
class U>
324 struct is_convertible
332 static Big Test( ... );
333 static Small Test( U );
339 value =
sizeof( Small ) ==
sizeof( ( Test( MakeT() ) ) )
345 template<
class T>
struct is_convertible<T, T > {
enum { value =
true }; };
348 template<
class T>
struct is_convertible<void, T > {
enum { value =
false }; };
351 template<
class T>
struct is_convertible<T, void> {
enum { value =
false }; };
354 template<>
struct is_convertible<void, void> {
enum { value =
true }; };
356# if defined( DISTI_USER_DEFINED_IS_TRIVIALLY_DESTRUCTIBLE )
357# define DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( DISTI_USER_DEFINED_IS_TRIVIALLY_DESTRUCTIBLE( T ) )
361# if defined( _MSC_VER )
362# define DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( __has_trivial_destructor( T ) || ( __is_pod( T ) && __has_trivial_constructor( T ) ) )
366# define DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( __has_trivial_destructor( T ) )
369# if defined( DISTI_USER_DEFINED_IS_DESTRUCTIBLE )
370# define DISTI_TT_IS_DESTRUCTIBLE( T ) ( DISTI_USER_DEFINED_IS_DESTRUCTIBLE( T ) )
374# define DISTI_TT_IS_DESTRUCTIBLE( T ) ( __is_pod( T ) || __is_class( T ) )
378# ifndef DOXYGEN_IGNORE
379 template<
typename T, T Val>
380 struct integral_constant
382 static const T value;
383 typedef T value_type;
384 typedef integral_constant<T, Val> type;
385 operator value_type() {
return value; }
388 template<
typename T, T Val>
389 const T integral_constant<T, Val>::value = Val;
391 typedef integral_constant<bool, true> true_type;
392 typedef integral_constant<bool, false> false_type;
395 struct is_trivially_destructible
396 : integral_constant<bool, DISTI_TT_IS_DESTRUCTIBLE( T ) && DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T )>
405#if defined( DISTI_NO_STATIC_ASSERT )
406# undef DISTI_HAS_STATIC_ASSERT
407# define DISTI_STATIC_ASSERT( expr, msg )
410# define DISTI_PREPROC_STRINGIFY_HELPER( s ) # s
412# define DISTI_PREPROC_STRINGIFY( s ) DISTI_PREPROC_STRINGIFY_HELPER( s )
414# if defined( DISTI_HAS_STATIC_ASSERT )
424# define DISTI_STATIC_ASSERT( expr, msg ) static_assert( expr, DISTI_PREPROC_STRINGIFY( msg ) )
433# define DISTI_STATIC_ASSERT_STR( expr, msg ) static_assert( expr, msg )
438namespace _cppLangSupportDetail
443 struct CompileTimeError;
448 struct CompileTimeError<true>
450 CompileTimeError() {}
451 CompileTimeError(
const char* ) {}
466# define DISTI_STATIC_ASSERT( expr, msg ) \
468 ::disti::_cppLangSupportDetail::CompileTimeError<( ( expr ) != 0 )> ERROR_##msg; \
478# define DISTI_STATIC_ASSERT_STR( expr, msg ) \
480 ::disti::_cppLangSupportDetail::CompileTimeError<( ( expr ) != 0 )> ERROR_##__LINE__( msg ); \
481 (void)ERROR_##__LINE__; \
487#if defined( DISTI_HAS_DEPRECATED_ATTRIBUTE ) && !defined( DISTI_NO_DEPRECATED_ATTRIBUTE )
488# define DISTI_DEPRECATED( msg ) [[deprecated( msg )]]
490# define DISTI_DEPRECATED( msg )
501template<>
struct MaxDigits10<float> {
static const unsigned long value = 2 + (FLT_MANT_DIG * 30103UL) / 100000UL; };
503template<>
struct MaxDigits10<double> {
static const unsigned long value = 2 + (DBL_MANT_DIG * 30103UL) / 100000UL; };
505template<>
struct MaxDigits10<long double> {
static const unsigned long value = 2 + (LDBL_MANT_DIG * 30103UL) / 100000UL; };
511#if defined( __GNUC__ ) || defined( __clang__ )
524#if defined( __GNUC__ ) || defined( __clang__ )
525 static char* s_unmangledName = NULL;
526 std::free( s_unmangledName );
530 s_unmangledName = abi::__cxa_demangle(
typeid( T ).name(), NULL, NULL, &status );
534 return s_unmangledName;
537 return typeid( T ).name();
Definition: bmpimage.h:47
const char * Demangle()
Definition: gls_cpp_lang_support.h:522
Definition: gls_cpp_lang_support.h:499
static const unsigned long value
Definition: gls_cpp_lang_support.h:499