40 #ifndef INCLUDED_GLS_CPP_LANG_SUPPORT_H
41 #define INCLUDED_GLS_CPP_LANG_SUPPORT_H
73 #if defined( _MSC_VER )
74 # if _MSC_VER >= 1700 // >= VS2012
75 # define DISTI_HAS_RVAL_REFS
76 # define DISTI_HAS_METHOD_OVERRIDE
77 # define DISTI_HAS_TYPE_TRAITS
78 # define DISTI_HAS_STATIC_ASSERT
80 # if _MSC_VER >= 1800 // >= VS2013
81 # define DISTI_HAS_SPECIAL_MEM_FUN_DEL
82 # define DISTI_HAS_CPP11
84 # if _MSC_VER >= 1900 // >= VS2015
85 # define DISTI_HAS_USER_DEFINED_LITERALS
87 # if _MSC_VER >= 1911 && __cplusplus >= 201402L // >= VS2017 15.3
88 # define DISTI_HAS_NOEXCEPT
89 # define DISTI_HAS_DEPRECATED_ATTRIBUTE
90 # define DISTI_HAS_CPP14
96 #elif defined( __GNUC__ )
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 // This actually depends on which standard library is in use, but it's a safe bet.
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 && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __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 // Guess that if we have rvalue refs, we've got pretty solid C++11 support
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
158 # define DISTI_HAS_CPP11
159 # define DISTI_HAS_DEPRECATED_ATTRIBUTE
162 #ifdef DISTI_HAS_CPP11
163 # define DISTI_IF_HAS_CPP11( x ) x
164 # define DISTI_IF_HAS_CPP11_ELSE( x, y ) x
166 # define DISTI_HAS_RVAL_REFS
167 # define DISTI_HAS_METHOD_OVERRIDE
168 # define DISTI_HAS_SPECIAL_MEM_FUN_DEL
169 # define DISTI_HAS_TYPE_TRAITS
170 # define DISTI_HAS_STATIC_ASSERT
174 # define DISTI_IF_HAS_CPP11( x )
175 # define DISTI_IF_HAS_CPP11_ELSE( x, y ) y
181 #if !defined( DISTI_NO_RVAL_REFS ) && defined( DISTI_HAS_RVAL_REFS )
183 # define DISTI_RVAL_MOVE( x ) std::move( x )
184 # define DISTI_IF_HAS_RVAL_REFS( x ) x
185 # define DISTI_IF_HAS_RVAL_REFS_ELSE( x, y ) x
187 # undef DISTI_HAS_RVAL_REFS
188 # define DISTI_RVAL_MOVE( x ) x
189 # define DISTI_IF_HAS_RVAL_REFS( x )
190 # define DISTI_IF_HAS_RVAL_REFS_ELSE( x, y ) y
194 #if !defined( DISTI_NO_METHOD_OVERRIDE ) && defined( DISTI_HAS_METHOD_OVERRIDE )
196 # define DISTI_METHOD_OVERRIDE override
198 # define DISTI_METHOD_FINAL final
200 # undef DISTI_HAS_METHOD_OVERRIDE
201 # define DISTI_METHOD_OVERRIDE
202 # define DISTI_METHOD_FINAL
206 #if !defined( DISTI_NO_NOEXCEPT ) && defined( DISTI_HAS_NOEXCEPT )
208 # define DISTI_FUNC_NOEXCEPT noexcept
210 # undef DISTI_HAS_NOEXCEPT
211 # define DISTI_FUNC_NOEXCEPT
215 #if !defined( DISTI_NO_SPECIAL_MEM_FUN_DEL ) && defined( DISTI_HAS_SPECIAL_MEM_FUN_DEL )
217 # define DISTI_SPECIAL_MEM_FUN_DELETE = delete
219 # undef DISTI_HAS_SPECIAL_MEM_FUN_DEL
220 # define DISTI_SPECIAL_MEM_FUN_DELETE
224 #if !defined( DISTI_NO_USER_DEFINED_LITERALS ) && defined( DISTI_HAS_USER_DEFINED_LITERALS )
225 # define DISTI_IF_HAS_USER_DEFINED_LITERAL( x ) x
227 # undef DISTI_HAS_USER_DEFINED_LITERALS
228 # define DISTI_IF_HAS_USER_DEFINED_LITERAL( x )
232 #if !defined( DISTI_NO_TYPE_TRAITS ) && defined( DISTI_HAS_TYPE_TRAITS )
235 # define DISTI_IF_HAS_TYPE_TRAITS_ELSE( x, y ) x
237 # undef DISTI_HAS_TYPE_TRAITS
238 # define DISTI_IF_HAS_TYPE_TRAITS_ELSE( x, y ) y
244 namespace _cppLangSupportDetail
260 template<
class T,
class U>
269 static Big Test( ... );
270 static Small Test( U );
276 value =
sizeof( Small ) ==
sizeof( ( Test( MakeT() ) ) )
317 #if defined( DISTI_NO_STATIC_ASSERT )
318 # undef DISTI_HAS_STATIC_ASSERT
319 # define DISTI_STATIC_ASSERT( expr, msg )
321 # define DISTI_PREPROC_STRINGIFY_HELPER( s ) # s
322 # define DISTI_PREPROC_STRINGIFY( s ) DISTI_PREPROC_STRINGIFY_HELPER( s )
324 # if defined( DISTI_HAS_STATIC_ASSERT )
334 # define DISTI_STATIC_ASSERT( expr, msg ) static_assert( expr, DISTI_PREPROC_STRINGIFY( msg ) )
338 namespace _cppLangSupportDetail
362 # define DISTI_STATIC_ASSERT( expr, msg ) \
364 ::disti::_cppLangSupportDetail::CompileTimeError<( ( expr ) != 0 )> ERROR_##msg; \
378 #ifdef DISTI_HAS_TYPE_TRAITS
379 # define DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO( T, ConvertsTo ) DISTI_STATIC_ASSERT( ( std::is_convertible<T*, ConvertsTo*>::value ), class_does_not_inherit_from_##ConvertsTo );
381 # 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 )
385 #if defined( DISTI_HAS_DEPRECATED_ATTRIBUTE ) && !defined( DISTI_NO_DEPRECATED_ATTRIBUTE )
386 # define DISTI_DEPRECATED( msg ) [[deprecated( msg )]]
388 # define DISTI_DEPRECATED( msg )
399 template<
class T>
struct MaxDigits10 {
static const unsigned long value = 0; };
400 template<>
struct MaxDigits10<float> {
static const unsigned long value = 2 + (FLT_MANT_DIG * 30103UL) / 100000UL; };
401 template<>
struct MaxDigits10<double> {
static const unsigned long value = 2 + (DBL_MANT_DIG * 30103UL) / 100000UL; };
402 template<>
struct MaxDigits10<long double> {
static const unsigned long value = 2 + (LDBL_MANT_DIG * 30103UL) / 100000UL; };
Replacement for std::is_convertible, adapted from Loki 0.1.7.
Definition: gls_cpp_lang_support.h:261
Definition: gls_cpp_lang_support.h:343
Definition: gls_cpp_lang_support.h:399
Definition: bmpimage.h:46