39#ifndef INCLUDED_GLS_CPP_LANG_SUPPORT_H
40#define INCLUDED_GLS_CPP_LANG_SUPPORT_H
72#if defined( _MSC_VER )
74# define DISTI_HAS_RVAL_REFS
75# define DISTI_HAS_METHOD_OVERRIDE
76# define DISTI_HAS_TYPE_TRAITS
77# define DISTI_HAS_STATIC_ASSERT
80# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
81# define DISTI_HAS_CPP11
84# define DISTI_HAS_USER_DEFINED_LITERALS
86# if _MSC_VER >= 1911 && __cplusplus >= 201402L
87# define DISTI_HAS_NOEXCEPT
88# define DISTI_HAS_DEPRECATED_ATTRIBUTE
89# define DISTI_HAS_CPP14
95#elif defined( __GNUC__ ) && !defined( __clang__ )
97# if __cpp_rvalue_references >= 200610 || ( ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L ) )
98# define DISTI_HAS_RVAL_REFS
100# if __cpp_static_assert >= 200410 && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
101# define DISTI_HAS_STATIC_ASSERT
103# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 9 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
104# define DISTI_HAS_USER_DEFINED_LITERALS
106# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 7 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
107# define DISTI_HAS_METHOD_OVERRIDE
108# define DISTI_HAS_NOEXCEPT
109# define DISTI_HAS_TYPE_TRAITS
110# define DISTI_HAS_CPP11
112# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L )
113# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
115# if( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 9 ) ) && __cplusplus >= 201402L
116# define DISTI_HAS_DEPRECATED_ATTRIBUTE
117# define DISTI_HAS_CPP14
123#elif defined( __clang__ )
124# if __has_feature( cxx_rvalue_references )
125# define DISTI_HAS_RVAL_REFS
126# define DISTI_HAS_CPP11
128# if __has_feature( cxx_override_control )
129# define DISTI_HAS_METHOD_OVERRIDE
131# if __has_feature( cxx_noexcept )
132# define DISTI_HAS_NOEXCEPT
134# if __has_feature( cxx_defaulted_functions ) && __has_feature( cxx_deleted_functions )
135# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
137# if __has_feature( cxx_static_assert )
138# define DISTI_HAS_STATIC_ASSERT
140# if __has_feature( cxx_user_literals )
141# define DISTI_HAS_USER_DEFINED_LITERALS
143# if( __clang_major__ > 3 || ( __clang_major__ == 3 && __clang_minor__ >= 4 ) ) && __cplusplus >= 201402L
144# define DISTI_HAS_DEPRECATED_ATTRIBUTE
145# define DISTI_HAS_CPP14
148# define DISTI_HAS_TYPE_TRAITS
156#ifdef DISTI_HAS_CPP14
158# define DISTI_HAS_CPP11
160# define DISTI_HAS_DEPRECATED_ATTRIBUTE
163#ifdef DISTI_HAS_CPP11
165# define DISTI_IF_HAS_CPP11( x ) x
167# define DISTI_IF_HAS_CPP11_ELSE( x, y ) x
170# define DISTI_HAS_RVAL_REFS
172# define DISTI_HAS_METHOD_OVERRIDE
174# define DISTI_HAS_SPECIAL_MEM_FUN_DEL
176# define DISTI_HAS_TYPE_TRAITS
178# define DISTI_HAS_STATIC_ASSERT
184# define DISTI_IF_HAS_CPP11( x )
186# define DISTI_IF_HAS_CPP11_ELSE( x, y ) y
192#if !defined( DISTI_NO_RVAL_REFS ) && defined( DISTI_HAS_RVAL_REFS )
195# define DISTI_RVAL_MOVE( x ) std::move( x )
197# define DISTI_UREF_FORWARD( T, x ) std::forward<T>( x )
199# define DISTI_UREF( T ) T&&
201# define DISTI_IF_HAS_RVAL_REFS( x ) x
203# define DISTI_IF_HAS_RVAL_REFS_ELSE( x, y ) x
205# undef DISTI_HAS_RVAL_REFS
207# define DISTI_RVAL_MOVE( x ) x
209# define DISTI_UREF_FORWARD( T, x ) x
211# define DISTI_UREF( T ) const T&
213# define DISTI_IF_HAS_RVAL_REFS( x )
215# define DISTI_IF_HAS_RVAL_REFS_ELSE( x, y ) y
219#if !defined( DISTI_NO_METHOD_OVERRIDE ) && defined( DISTI_HAS_METHOD_OVERRIDE )
221# define DISTI_METHOD_OVERRIDE override
223# define DISTI_FINAL final
225# undef DISTI_HAS_METHOD_OVERRIDE
227# define DISTI_METHOD_OVERRIDE
233#if !defined( DISTI_NO_NOEXCEPT ) && defined( DISTI_HAS_NOEXCEPT )
235# define DISTI_FUNC_NOEXCEPT noexcept
237# undef DISTI_HAS_NOEXCEPT
239# define DISTI_FUNC_NOEXCEPT
243#if !defined( DISTI_NO_SPECIAL_MEM_FUN_DEL ) && defined( DISTI_HAS_SPECIAL_MEM_FUN_DEL )
245# define DISTI_SPECIAL_MEM_FUN_DELETE = delete
247# undef DISTI_HAS_SPECIAL_MEM_FUN_DEL
249# define DISTI_SPECIAL_MEM_FUN_DELETE
253#if !defined( DISTI_NO_USER_DEFINED_LITERALS ) && defined( DISTI_HAS_USER_DEFINED_LITERALS )
255# define DISTI_IF_HAS_USER_DEFINED_LITERAL( x ) x
257# undef DISTI_HAS_USER_DEFINED_LITERALS
259# define DISTI_IF_HAS_USER_DEFINED_LITERAL( x )
263#if !defined( DISTI_NO_TYPE_TRAITS ) && defined( DISTI_HAS_TYPE_TRAITS )
268# define DISTI_IF_HAS_TYPE_TRAITS_ELSE( x, y ) x
276# define DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO( T, ConvertsTo ) DISTI_STATIC_ASSERT( ( std::is_convertible<T*, ConvertsTo*>::value ), class_does_not_inherit_from_##ConvertsTo );
279# define DISTI_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( std::is_trivially_destructible<T>() )
281# define DISTI_TT_TRUE_TYPE std::true_type
283# define DISTI_TT_FALSE_TYPE std::false_type
285# undef DISTI_HAS_TYPE_TRAITS
290# define DISTI_IF_HAS_TYPE_TRAITS_ELSE( x, y ) y
292# ifndef DOXYGEN_IGNORE
294# 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 )
297# define DISTI_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( ::disti::_cppLangSupportDetail::is_trivially_destructible<T>() )
298# define DISTI_TT_TRUE_TYPE ::disti::_cppLangSupportDetail::true_type
299# define DISTI_TT_FALSE_TYPE ::disti::_cppLangSupportDetail::false_type
306namespace _cppLangSupportDetail
322 template<
class T,
class U>
323 struct is_convertible
331 static Big Test( ... );
332 static Small Test( U );
338 value =
sizeof( Small ) ==
sizeof( ( Test( MakeT() ) ) )
344 template<
class T>
struct is_convertible<T, T > {
enum { value =
true }; };
347 template<
class T>
struct is_convertible<void, T > {
enum { value =
false }; };
350 template<
class T>
struct is_convertible<T, void> {
enum { value =
false }; };
353 template<>
struct is_convertible<void, void> {
enum { value =
true }; };
355# if defined( DISTI_USER_DEFINED_IS_TRIVIALLY_DESTRUCTIBLE )
356# define DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( DISTI_USER_DEFINED_IS_TRIVIALLY_DESTRUCTIBLE( T ) )
360# if defined( _MSC_VER )
361# define DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( __has_trivial_destructor( T ) || ( __is_pod( T ) && __has_trivial_constructor( T ) ) )
365# define DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T ) ( __has_trivial_destructor( T ) )
368# if defined( DISTI_USER_DEFINED_IS_DESTRUCTIBLE )
369# define DISTI_TT_IS_DESTRUCTIBLE( T ) ( DISTI_USER_DEFINED_IS_DESTRUCTIBLE( T ) )
373# define DISTI_TT_IS_DESTRUCTIBLE( T ) ( __is_pod( T ) || __is_class( T ) )
377# ifndef DOXYGEN_IGNORE
378 template<
typename T, T Val>
379 struct integral_constant
381 static const T value;
382 typedef T value_type;
383 typedef integral_constant<T, Val> type;
384 operator value_type() {
return value; }
387 template<
typename T, T Val>
388 const T integral_constant<T, Val>::value = Val;
390 typedef integral_constant<bool, true> true_type;
391 typedef integral_constant<bool, false> false_type;
394 struct is_trivially_destructible
395 : integral_constant<bool, DISTI_TT_IS_DESTRUCTIBLE( T ) && DISTI_TT_IS_TRIVIALLY_DESTRUCTIBLE( T )>
404#if defined( DISTI_NO_STATIC_ASSERT )
405# undef DISTI_HAS_STATIC_ASSERT
406# define DISTI_STATIC_ASSERT( expr, msg )
409# define DISTI_PREPROC_STRINGIFY_HELPER( s ) # s
411# define DISTI_PREPROC_STRINGIFY( s ) DISTI_PREPROC_STRINGIFY_HELPER( s )
413# if defined( DISTI_HAS_STATIC_ASSERT )
423# define DISTI_STATIC_ASSERT( expr, msg ) static_assert( expr, DISTI_PREPROC_STRINGIFY( msg ) )
432# define DISTI_STATIC_ASSERT_STR( expr, msg ) static_assert( expr, msg )
437namespace _cppLangSupportDetail
442 struct CompileTimeError;
447 struct CompileTimeError<true>
449 CompileTimeError() {}
450 CompileTimeError(
const char* ) {}
465# define DISTI_STATIC_ASSERT( expr, msg ) \
467 ::disti::_cppLangSupportDetail::CompileTimeError<( ( expr ) != 0 )> ERROR_##msg; \
477# define DISTI_STATIC_ASSERT_STR( expr, msg ) \
479 ::disti::_cppLangSupportDetail::CompileTimeError<( ( expr ) != 0 )> ERROR_##__LINE__( msg ); \
480 (void)ERROR_##__LINE__; \
486#if defined( DISTI_HAS_DEPRECATED_ATTRIBUTE ) && !defined( DISTI_NO_DEPRECATED_ATTRIBUTE )
487# define DISTI_DEPRECATED( msg ) [[deprecated( msg )]]
489# define DISTI_DEPRECATED( msg )
500template<>
struct MaxDigits10<float> {
static const unsigned long value = 2 + (FLT_MANT_DIG * 30103UL) / 100000UL; };
502template<>
struct MaxDigits10<double> {
static const unsigned long value = 2 + (DBL_MANT_DIG * 30103UL) / 100000UL; };
504template<>
struct MaxDigits10<long double> {
static const unsigned long value = 2 + (LDBL_MANT_DIG * 30103UL) / 100000UL; };
510#if defined( __GNUC__ ) || defined( __clang__ )
523#if defined( __GNUC__ ) || defined( __clang__ )
524 static char* s_unmangledName = NULL;
525 std::free( s_unmangledName );
529 s_unmangledName = abi::__cxa_demangle(
typeid( T ).name(), NULL, NULL, &status );
533 return s_unmangledName;
536 return typeid( T ).name();
Definition: bmpimage.h:46
const char * Demangle()
Definition: gls_cpp_lang_support.h:521
Definition: gls_cpp_lang_support.h:498
static const unsigned long value
Definition: gls_cpp_lang_support.h:498