/src/boost/boost/charconv/to_chars.hpp
Line | Count | Source |
1 | | // Copyright 2022 Peter Dimov |
2 | | // Copyright 2023 Matt Borland |
3 | | // Copyright 2023 Junekey Jeon |
4 | | // Distributed under the Boost Software License, Version 1.0. |
5 | | // https://www.boost.org/LICENSE_1_0.txt |
6 | | |
7 | | #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED |
8 | | #define BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED |
9 | | |
10 | | #include <boost/charconv/detail/to_chars_integer_impl.hpp> |
11 | | #include <boost/charconv/detail/to_chars_result.hpp> |
12 | | #include <boost/charconv/config.hpp> |
13 | | #include <boost/charconv/chars_format.hpp> |
14 | | |
15 | | namespace boost { |
16 | | namespace charconv { |
17 | | |
18 | | // integer overloads |
19 | | BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, bool value, int base) noexcept = delete; |
20 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, char value, int base = 10) noexcept |
21 | 0 | { |
22 | 0 | return detail::to_chars_int(first, last, value, base); |
23 | 0 | } |
24 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, signed char value, int base = 10) noexcept |
25 | 0 | { |
26 | 0 | return detail::to_chars_int(first, last, value, base); |
27 | 0 | } |
28 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned char value, int base = 10) noexcept |
29 | 0 | { |
30 | 0 | return detail::to_chars_int(first, last, value, base); |
31 | 0 | } |
32 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, short value, int base = 10) noexcept |
33 | 0 | { |
34 | 0 | return detail::to_chars_int(first, last, value, base); |
35 | 0 | } |
36 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned short value, int base = 10) noexcept |
37 | 0 | { |
38 | 0 | return detail::to_chars_int(first, last, value, base); |
39 | 0 | } |
40 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, int value, int base = 10) noexcept |
41 | 0 | { |
42 | 0 | return detail::to_chars_int(first, last, value, base); |
43 | 0 | } |
44 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned int value, int base = 10) noexcept |
45 | 0 | { |
46 | 0 | return detail::to_chars_int(first, last, value, base); |
47 | 0 | } |
48 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long value, int base = 10) noexcept |
49 | 0 | { |
50 | 0 | return detail::to_chars_int(first, last, value, base); |
51 | 0 | } |
52 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long value, int base = 10) noexcept |
53 | 0 | { |
54 | 0 | return detail::to_chars_int(first, last, value, base); |
55 | 0 | } |
56 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long long value, int base = 10) noexcept |
57 | 0 | { |
58 | 0 | return detail::to_chars_int(first, last, value, base); |
59 | 0 | } |
60 | | BOOST_CHARCONV_HOST_DEVICE BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long long value, int base = 10) noexcept |
61 | 0 | { |
62 | 0 | return detail::to_chars_int(first, last, value, base); |
63 | 0 | } |
64 | | |
65 | | #ifdef BOOST_CHARCONV_HAS_INT128 |
66 | | BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::int128_type value, int base = 10) noexcept |
67 | 0 | { |
68 | 0 | return detail::to_chars128(first, last, value, base); |
69 | 0 | } |
70 | | BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::uint128_type value, int base = 10) noexcept |
71 | 0 | { |
72 | 0 | return detail::to_chars128(first, last, value, base); |
73 | 0 | } |
74 | | #endif |
75 | | |
76 | | //---------------------------------------------------------------------------------------------------------------------- |
77 | | // Floating Point |
78 | | //---------------------------------------------------------------------------------------------------------------------- |
79 | | |
80 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value, |
81 | | chars_format fmt = chars_format::general) noexcept; |
82 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value, |
83 | | chars_format fmt = chars_format::general) noexcept; |
84 | | |
85 | | #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE |
86 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value, |
87 | | chars_format fmt = chars_format::general) noexcept; |
88 | | #endif |
89 | | |
90 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value, |
91 | | chars_format fmt, int precision) noexcept; |
92 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value, |
93 | | chars_format fmt, int precision) noexcept; |
94 | | |
95 | | #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE |
96 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value, |
97 | | chars_format fmt, int precision) noexcept; |
98 | | #endif |
99 | | |
100 | | #ifdef BOOST_CHARCONV_HAS_QUADMATH |
101 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value, |
102 | | chars_format fmt = chars_format::general) noexcept; |
103 | | |
104 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value, |
105 | | chars_format fmt, int precision) noexcept; |
106 | | #endif |
107 | | |
108 | | #ifdef BOOST_CHARCONV_HAS_FLOAT16 |
109 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value, |
110 | | chars_format fmt = chars_format::general) noexcept; |
111 | | |
112 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value, |
113 | | chars_format fmt, int precision) noexcept; |
114 | | #endif |
115 | | #ifdef BOOST_CHARCONV_HAS_FLOAT32 |
116 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value, |
117 | | chars_format fmt = chars_format::general) noexcept; |
118 | | |
119 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value, |
120 | | chars_format fmt, int precision) noexcept; |
121 | | #endif |
122 | | #ifdef BOOST_CHARCONV_HAS_FLOAT64 |
123 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value, |
124 | | chars_format fmt = chars_format::general) noexcept; |
125 | | |
126 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value, |
127 | | chars_format fmt, int precision) noexcept; |
128 | | #endif |
129 | | #if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_QUADMATH) |
130 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value, |
131 | | chars_format fmt = chars_format::general) noexcept; |
132 | | |
133 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value, |
134 | | chars_format fmt, int precision) noexcept; |
135 | | #endif |
136 | | #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 |
137 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value, |
138 | | chars_format fmt = chars_format::general) noexcept; |
139 | | |
140 | | BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value, |
141 | | chars_format fmt, int precision) noexcept; |
142 | | #endif |
143 | | |
144 | | } // namespace charconv |
145 | | } // namespace boost |
146 | | |
147 | | #endif // #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED |