Debian Codegraph @

include/fast_float/constexpr_feature_detect.h

raw
1 #ifndef FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H
2 #define FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H
3
4 #ifdef __has_include
5 #if __has_include(<version>)
6 #include <version>
7 #endif
8 #endif
9
10 // Testing for https://wg21.link/N3652, adopted in C++14
11 #if defined(__cpp_constexpr) && __cpp_constexpr >= 201304
12 #define FASTFLOAT_CONSTEXPR14 constexpr
13 #else
14 #define FASTFLOAT_CONSTEXPR14
15 #endif
16
17 #if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
18 #define FASTFLOAT_HAS_BIT_CAST 1
19 #else
20 #define FASTFLOAT_HAS_BIT_CAST 0
21 #endif
22
23 #if defined(__cpp_lib_is_constant_evaluated) && \
24 __cpp_lib_is_constant_evaluated >= 201811L
25 #define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 1
26 #else
27 #define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 0
28 #endif
29
30 #if defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606L
31 #define FASTFLOAT_IF_CONSTEXPR17(x) if constexpr (x)
32 #else
33 #define FASTFLOAT_IF_CONSTEXPR17(x) if (x)
34 #endif
35
36 // Testing for relevant C++20 constexpr library features
37 #if FASTFLOAT_HAS_IS_CONSTANT_EVALUATED && FASTFLOAT_HAS_BIT_CAST && \
38 defined(__cpp_lib_constexpr_algorithms) && \
39 __cpp_lib_constexpr_algorithms >= 201806L /*For std::copy and std::fill*/
40 #define FASTFLOAT_CONSTEXPR20 constexpr
41 #define FASTFLOAT_IS_CONSTEXPR 1
42 #else
43 #define FASTFLOAT_CONSTEXPR20
44 #define FASTFLOAT_IS_CONSTEXPR 0
45 #endif
46
47 #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
48 #define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 0
49 #else
50 #define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 1
51 #endif
52
53 #endif // FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H