Version 7.0.0 of fast_float has just been released.
One major change is that char_format is no longer an enum, but an enum class with underlying type uint64_t.
This requires a bit of adaptation, something like this, which should be backwards-compatible with older fast_float releases:
diff --git a/src/scn/impl.cpp b/src/scn/impl.cpp
index aa0d334..2ad35ff 100644
--- a/src/scn/impl.cpp
+++ b/src/scn/impl.cpp
@@ -721,12 +721,14 @@ scan_expected<std::ptrdiff_t> fast_float_fallback(impl_init_data<CharT> data,
struct fast_float_impl_base : impl_base {
fast_float::chars_format get_flags() const
{
- unsigned format_flags{};
+ uint64_t format_flags{};
if ((m_options & float_reader_base::allow_fixed) != 0) {
- format_flags |= fast_float::fixed;
+ format_flags |=
+ static_cast<uint64_t>(fast_float::chars_format::fixed);
}
if ((m_options & float_reader_base::allow_scientific) != 0) {
- format_flags |= fast_float::scientific;
+ format_flags |=
+ static_cast<uint64_t>(fast_float::chars_format::scientific);
}
return static_cast<fast_float::chars_format>(format_flags);
However, I still have a problem after making this change:
In file included from /home/ben/src/forks/scnlib/build/_deps/fast_float-src/include/fast_float/fast_float.h:57,
from /home/ben/src/forks/scnlib/benchmark/runtime/float/single.cpp:26:
/home/ben/src/forks/scnlib/build/_deps/fast_float-src/include/fast_float/parse_number.h: In instantiation of ‘fast_float::from_chars_result_t<UC> fast_float::from_chars(const UC*, const UC*, T&, int) [with T = long double; UC = char; <template-parameter-1-3> = int]’:
/home/ben/src/forks/scnlib/benchmark/runtime/float/single.cpp:176:42: required from ‘void scan_float_single_fastfloat(benchmark::State&) [with Float = long double]’
176 | auto ret = fast_float::from_chars(s.it->data(),
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
177 | s.it->data() + s.it->size(), f);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ben/src/forks/scnlib/benchmark/runtime/float/single.cpp:188:1: required from here
1539 | #n "<" #__VA_ARGS__ ">", n<__VA_ARGS__>)))
| ^
/home/ben/src/forks/scnlib/build/_deps/fast_float-src/include/fast_float/parse_number.h:326:38: error: static assertion failed: only integer types are supported
326 | static_assert(std::is_integral<T>::value, "only integer types are supported");
| ^~~~~
/home/ben/src/forks/scnlib/build/_deps/fast_float-src/include/fast_float/parse_number.h:326:38: note: ‘std::integral_constant<bool, false>::value’ evaluates to false
This error is coming from code that was added in fastfloat/fast_float@0bbba96 as part of fastfloat/fast_float#280, but it’s not immediately clear to me whether this is a regression in fast_float or whether it reflects something that ought to be changed in scnlib.
I’ll open a draft PR corresponding to the work described above.
Version 7.0.0 of
fast_floathas just been released.One major change is that
char_formatis no longer anenum, but anenum classwith underlying typeuint64_t.This requires a bit of adaptation, something like this, which should be backwards-compatible with older
fast_floatreleases:However, I still have a problem after making this change:
This error is coming from code that was added in fastfloat/fast_float@0bbba96 as part of fastfloat/fast_float#280, but it’s not immediately clear to me whether this is a regression in
fast_floator whether it reflects something that ought to be changed inscnlib.I’ll open a draft PR corresponding to the work described above.