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
15namespace boost {
16namespace charconv {
17
18// integer overloads
19BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, bool value, int base) noexcept = delete;
20BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, char value, int base = 10) noexcept
21{
22 return detail::to_chars_int(first, last, value, base);
23}
24BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, signed char value, int base = 10) noexcept
25{
26 return detail::to_chars_int(first, last, value, base);
27}
28BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned char value, int base = 10) noexcept
29{
30 return detail::to_chars_int(first, last, value, base);
31}
32BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, short value, int base = 10) noexcept
33{
34 return detail::to_chars_int(first, last, value, base);
35}
36BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned short value, int base = 10) noexcept
37{
38 return detail::to_chars_int(first, last, value, base);
39}
40BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, int value, int base = 10) noexcept
41{
42 return detail::to_chars_int(first, last, value, base);
43}
44BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned int value, int base = 10) noexcept
45{
46 return detail::to_chars_int(first, last, value, base);
47}
48BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long value, int base = 10) noexcept
49{
50 return detail::to_chars_int(first, last, value, base);
51}
52BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long value, int base = 10) noexcept
53{
54 return detail::to_chars_int(first, last, value, base);
55}
56BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long long value, int base = 10) noexcept
57{
58 return detail::to_chars_int(first, last, value, base);
59}
60BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long long value, int base = 10) noexcept
61{
62 return detail::to_chars_int(first, last, value, base);
63}
64
65#ifdef BOOST_CHARCONV_HAS_INT128
66BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::int128_type value, int base = 10) noexcept
67{
68 return detail::to_chars128(first, last, value, base);
69}
70BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::uint128_type value, int base = 10) noexcept
71{
72 return detail::to_chars128(first, last, value, base);
73}
74#endif
75
76//----------------------------------------------------------------------------------------------------------------------
77// Floating Point
78//----------------------------------------------------------------------------------------------------------------------
79
80BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value,
81 chars_format fmt = chars_format::general) noexcept;
82BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value,
83 chars_format fmt = chars_format::general) noexcept;
84BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value,
85 chars_format fmt = chars_format::general) noexcept;
86
87BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value,
88 chars_format fmt, int precision) noexcept;
89BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value,
90 chars_format fmt, int precision) noexcept;
91BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value,
92 chars_format fmt, int precision) noexcept;
93
94#ifdef BOOST_CHARCONV_HAS_FLOAT128
95BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value,
96 chars_format fmt = chars_format::general) noexcept;
97
98BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value,
99 chars_format fmt, int precision) noexcept;
100#endif
101
102#ifdef BOOST_CHARCONV_HAS_FLOAT16
103BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value,
104 chars_format fmt = chars_format::general) noexcept;
105
106BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value,
107 chars_format fmt, int precision) noexcept;
108#endif
109#ifdef BOOST_CHARCONV_HAS_FLOAT32
110BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value,
111 chars_format fmt = chars_format::general) noexcept;
112
113BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value,
114 chars_format fmt, int precision) noexcept;
115#endif
116#ifdef BOOST_CHARCONV_HAS_FLOAT64
117BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value,
118 chars_format fmt = chars_format::general) noexcept;
119
120BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value,
121 chars_format fmt, int precision) noexcept;
122#endif
123#if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_FLOAT128)
124BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value,
125 chars_format fmt = chars_format::general) noexcept;
126
127BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value,
128 chars_format fmt, int precision) noexcept;
129#endif
130#ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16
131BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value,
132 chars_format fmt = chars_format::general) noexcept;
133
134BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value,
135 chars_format fmt, int precision) noexcept;
136#endif
137
138} // namespace charconv
139} // namespace boost
140
141#endif // #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED
142

source code of boost/libs/charconv/include/boost/charconv/to_chars.hpp