Skip to content

Commit

Permalink
Change minimum compiler versions for <charconv> interop
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Oct 4, 2024
1 parent d6c5d0f commit db52157
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/decimal/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ This flag increases the performance of the basis operations (e.g. add, sub, mul,

- `BOOST_DECIMAL_HAS_STD_CHARCONV`: This macro is defined if header `<charconv>` exists and the language standard used is >= C++17
* We only need the structs and enums out of the header so we are not concerned with being overly restrictive about the feature test macros.
Implementations of integer `std::from_chars` and `std::to_chars` existed far before the floating points were completed to allow the feature test macro to be properly set.
** Known compilers that support this lighter requirement are: GCC >= 10, Clang >= 13, and MSVC >= 14.2
10 changes: 7 additions & 3 deletions include/boost/decimal/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,14 @@ typedef unsigned __int128 uint128_t;

#if __cplusplus >= 201703L
# if __has_include(<charconv>)
# ifndef BOOST_DECIMAL_BUILD_MODULE
# include <charconv>
// We don't need all of charconv, just: std::to_chars_result, std::from_chars_result, and std::chars_format
// These compilers and versions give us what we need
# if (defined(__clang_major__) && __clang_major__ >= 13) || (defined(__GNUC__) && __GNUC__ >= 10) || defined(_MSC_VER)
# ifndef BOOST_DECIMAL_BUILD_MODULE
# include <charconv>
# endif
# define BOOST_DECIMAL_HAS_STD_CHARCONV
# endif
# define BOOST_DECIMAL_HAS_STD_CHARCONV
# endif
#endif

Expand Down

0 comments on commit db52157

Please sign in to comment.