Skip to content

Commit 028d69b

Browse files
committed
Charconv is used to serialize doubles
1 parent ccdd27e commit 028d69b

24 files changed

Lines changed: 85 additions & 2497 deletions

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function(boost_json_setup_properties target)
8989
target_link_libraries(${target}
9090
PUBLIC
9191
Boost::assert
92+
Boost::charconv
9293
Boost::config
9394
Boost::container
9495
Boost::container_hash

build.jam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ using boost-pretty-printers ;
1212

1313
constant boost_dependencies :
1414
/boost/assert//boost_assert
15+
/boost/charconv//boost_charconv
1516
/boost/config//boost_config
1617
/boost/container//boost_container
1718
/boost/container_hash//boost_container_hash

build/Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ project
7070
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
7171
: usage-requirements
7272
<library>/boost/container//boost_container/<warnings-as-errors>off
73+
<library>/boost/charconv//boost_charconv/<warnings-as-errors>off
7374
<define>BOOST_JSON_NO_LIB=1
7475
: source-location ../src
7576
;

include/boost/json/detail/format.hpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
#ifndef BOOST_JSON_DETAIL_FORMAT_HPP
1111
#define BOOST_JSON_DETAIL_FORMAT_HPP
1212

13+
#include <boost/charconv/limits.hpp>
14+
1315
namespace boost {
1416
namespace json {
1517
namespace detail {
1618

17-
int constexpr max_number_chars =
18-
1 + // '-'
19-
19 + // unsigned 64-bit mantissa
20-
1 + // 'e'
21-
1 + // '-'
22-
5; // unsigned 16-bit exponent
19+
constexpr
20+
std::size_t
21+
max_number_chars = boost::charconv::limits<double>::max_chars;
2322

2423
BOOST_JSON_DECL
2524
unsigned
@@ -32,11 +31,6 @@ unsigned
3231
format_int64(
3332
char* dest, int64_t i) noexcept;
3433

35-
BOOST_JSON_DECL
36-
unsigned
37-
format_double(
38-
char* dest, double d, bool allow_infinity_and_nan = false) noexcept;
39-
4034
} // detail
4135
} // namespace json
4236
} // namespace boost

include/boost/json/detail/impl/format.ipp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#ifndef BOOST_JSON_DETAIL_IMPL_FORMAT_IPP
1212
#define BOOST_JSON_DETAIL_IMPL_FORMAT_IPP
1313

14-
#include <boost/json/detail/ryu/ryu.hpp>
14+
#include <cmath>
1515
#include <cstring>
1616

1717
namespace boost {
@@ -110,14 +110,6 @@ format_int64(
110110
return 1 + format_uint64(dest, ui);
111111
}
112112

113-
unsigned
114-
format_double(
115-
char* dest, double d, bool allow_infinity_and_nan) noexcept
116-
{
117-
return static_cast<int>(
118-
ryu::d2s_buffered_n(d, dest, allow_infinity_and_nan));
119-
}
120-
121113
} // detail
122114
} // namespace json
123115
} // namespace boost

include/boost/json/detail/ryu/detail/common.hpp

Lines changed: 0 additions & 144 deletions
This file was deleted.

0 commit comments

Comments
 (0)