Skip to content

Commit c8abf94

Browse files
authored
Merge pull request #268 from yfeldblum/fix-deprecated-cxx17-cexpr-static-data-defn-out-of-line-redundant
remove out-of-line defns of constexpr static data members under c++17
2 parents f03b76f + 159589d commit c8abf94

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

include/fast_float/bigint.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,16 @@ template <typename = void> struct pow5_tables {
404404
#endif
405405
};
406406

407+
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
408+
407409
template <typename T> constexpr uint32_t pow5_tables<T>::large_step;
408410

409411
template <typename T> constexpr uint64_t pow5_tables<T>::small_power_of_5[];
410412

411413
template <typename T> constexpr limb pow5_tables<T>::large_power_of_5[];
412414

415+
#endif
416+
413417
// big integer type. implements a small subset of big integer
414418
// arithmetic, using simple algorithms since asymptotically
415419
// faster algorithms are slower for a small number of limbs.

include/fast_float/constexpr_feature_detect.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@
3737
#define FASTFLOAT_IS_CONSTEXPR 0
3838
#endif
3939

40+
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
41+
#define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 0
42+
#else
43+
#define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 1
44+
#endif
45+
4046
#endif // FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H

include/fast_float/fast_table.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,14 @@ template <class unused = void> struct powers_template {
693693
};
694694
};
695695

696+
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
697+
696698
template <class unused>
697699
constexpr uint64_t
698700
powers_template<unused>::power_of_five_128[number_of_entries];
699701

702+
#endif
703+
700704
using powers = powers_template<>;
701705

702706
} // namespace fast_float

include/fast_float/float_common.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,16 @@ template <typename U> struct binary_format_lookup_tables<double, U> {
442442
constant_55555 * 5 * 5 * 5 * 5)};
443443
};
444444

445+
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
446+
445447
template <typename U>
446448
constexpr double binary_format_lookup_tables<double, U>::powers_of_ten[];
447449

448450
template <typename U>
449451
constexpr uint64_t binary_format_lookup_tables<double, U>::max_mantissa[];
450452

453+
#endif
454+
451455
template <typename U> struct binary_format_lookup_tables<float, U> {
452456
static constexpr float powers_of_ten[] = {1e0f, 1e1f, 1e2f, 1e3f, 1e4f, 1e5f,
453457
1e6f, 1e7f, 1e8f, 1e9f, 1e10f};
@@ -469,12 +473,16 @@ template <typename U> struct binary_format_lookup_tables<float, U> {
469473
0x1000000 / (constant_55555 * constant_55555 * 5)};
470474
};
471475

476+
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
477+
472478
template <typename U>
473479
constexpr float binary_format_lookup_tables<float, U>::powers_of_ten[];
474480

475481
template <typename U>
476482
constexpr uint64_t binary_format_lookup_tables<float, U>::max_mantissa[];
477483

484+
#endif
485+
478486
template <>
479487
inline constexpr int binary_format<double>::min_exponent_fast_path() {
480488
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
@@ -677,8 +685,12 @@ template <typename = void> struct space_lut {
677685
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
678686
};
679687

688+
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
689+
680690
template <typename T> constexpr bool space_lut<T>::value[];
681691

692+
#endif
693+
682694
inline constexpr bool is_space(uint8_t c) { return space_lut<>::value[c]; }
683695
#endif
684696

@@ -759,12 +771,16 @@ template <typename = void> struct int_luts {
759771
3379220508056640625, 4738381338321616896};
760772
};
761773

774+
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
775+
762776
template <typename T> constexpr uint8_t int_luts<T>::chdigit[];
763777

764778
template <typename T> constexpr size_t int_luts<T>::maxdigits_u64[];
765779

766780
template <typename T> constexpr uint64_t int_luts<T>::min_safe_u64[];
767781

782+
#endif
783+
768784
template <typename UC>
769785
fastfloat_really_inline constexpr uint8_t ch_to_digit(UC c) {
770786
return int_luts<>::chdigit[static_cast<unsigned char>(c)];

0 commit comments

Comments
 (0)