Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libcxx/docs/ReleaseNotes/21.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,21 @@ Improvements and New Features

- Updated formatting library to Unicode 16.0.0.

- The ``num_put::do_put`` integral overloads have been optimized, resulting in a performance improvement of up to 2.4x.

Deprecations and Removals
-------------------------

- ``std::is_pod`` and ``std::is_pod_v`` are deprecated in C++20 and later.

- ``std::is_trivial`` and ``std::is_trivial_v`` are deprecated in C++26 and later.

Potentially breaking changes
----------------------------

- The implementation of ``num_put::do_put`` has been replaced to improve the performance, which can lead to different
output when printing pointers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It always leads to different output on Windows, right? libc++ never printed a 0x prefix on pointers on Windows before, and now it always does (making it consistent with libc++ on other platforms, and inconsistent with Microsoft's STL as far as I know). Maybe the release notes could be more precise about this :)


Upcoming Deprecations and Removals
----------------------------------

Expand Down
20 changes: 8 additions & 12 deletions libcxx/include/__charconv/tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 17

namespace __itoa {

inline constexpr char __base_2_lut[64] = {
inline _LIBCPP_CONSTEXPR const char __base_2_lut[64] = {
'0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '1', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1',
'0', '1', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0', '0', '1', '0', '0', '1', '1', '0', '1', '0',
'1', '0', '1', '1', '1', '1', '0', '0', '1', '1', '0', '1', '1', '1', '1', '0', '1', '1', '1', '1'};

inline constexpr char __base_8_lut[128] = {
inline _LIBCPP_CONSTEXPR const char __base_8_lut[128] = {
'0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '1', '0', '1', '1', '1', '2',
'1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5',
'2', '6', '2', '7', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '4', '0',
'4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '5', '0', '5', '1', '5', '2', '5', '3',
'5', '4', '5', '5', '5', '6', '5', '7', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6',
'6', '7', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7'};

inline constexpr char __base_16_lut[512] = {
inline _LIBCPP_CONSTEXPR const char __base_16_lut[512] = {
'0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0',
'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6',
'1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f', '2', '0', '2', '1', '2',
Expand All @@ -61,7 +59,7 @@ inline constexpr char __base_16_lut[512] = {
'1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c',
'f', 'd', 'f', 'e', 'f', 'f'};

inline constexpr uint32_t __pow10_32[10] = {
inline _LIBCPP_CONSTEXPR const uint32_t __pow10_32[10] = {
UINT32_C(0),
UINT32_C(10),
UINT32_C(100),
Expand All @@ -73,7 +71,7 @@ inline constexpr uint32_t __pow10_32[10] = {
UINT32_C(100000000),
UINT32_C(1000000000)};

inline constexpr uint64_t __pow10_64[20] = {
inline _LIBCPP_CONSTEXPR const uint64_t __pow10_64[20] = {
UINT64_C(0),
UINT64_C(10),
UINT64_C(100),
Expand All @@ -96,8 +94,8 @@ inline constexpr uint64_t __pow10_64[20] = {
UINT64_C(10000000000000000000)};

# if _LIBCPP_HAS_INT128
inline constexpr int __pow10_128_offset = 0;
inline constexpr __uint128_t __pow10_128[40] = {
inline _LIBCPP_CONSTEXPR const int __pow10_128_offset = 0;
inline _LIBCPP_CONSTEXPR const __uint128_t __pow10_128[40] = {
UINT64_C(0),
UINT64_C(10),
UINT64_C(100),
Expand Down Expand Up @@ -140,7 +138,7 @@ inline constexpr __uint128_t __pow10_128[40] = {
(__uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000000)) * 10};
# endif

inline constexpr char __digits_base_10[200] = {
inline _LIBCPP_CONSTEXPR const char __digits_base_10[200] = {
// clang-format off
'0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9',
'1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9',
Expand All @@ -156,8 +154,6 @@ inline constexpr char __digits_base_10[200] = {

} // namespace __itoa

#endif // _LIBCPP_STD_VER >= 17

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___CHARCONV_TABLES
32 changes: 14 additions & 18 deletions libcxx/include/__charconv/to_chars_base_10.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,53 @@ _LIBCPP_PUSH_MACROS

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 17

namespace __itoa {

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append1(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append1(char* __first, uint32_t __value) _NOEXCEPT {
*__first = '0' + static_cast<char>(__value);
return __first + 1;
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append2(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append2(char* __first, uint32_t __value) _NOEXCEPT {
return std::copy_n(&__digits_base_10[__value * 2], 2, __first);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append3(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append3(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append2(__itoa::__append1(__first, __value / 100), __value % 100);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append4(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append4(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append2(__itoa::__append2(__first, __value / 100), __value % 100);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append5(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append5(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append4(__itoa::__append1(__first, __value / 10000), __value % 10000);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append6(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append6(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append4(__itoa::__append2(__first, __value / 10000), __value % 10000);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append7(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append7(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append6(__itoa::__append1(__first, __value / 1000000), __value % 1000000);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append8(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append8(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append6(__itoa::__append2(__first, __value / 1000000), __value % 1000000);
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append9(char* __first, uint32_t __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append9(char* __first, uint32_t __value) _NOEXCEPT {
return __itoa::__append8(__itoa::__append1(__first, __value / 100000000), __value % 100000000);
}

template <class _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __append10(char* __first, _Tp __value) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __append10(char* __first, _Tp __value) _NOEXCEPT {
return __itoa::__append8(__itoa::__append2(__first, static_cast<uint32_t>(__value / 100000000)),
static_cast<uint32_t>(__value % 100000000));
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char*
__base_10_u32(char* __first, uint32_t __value) noexcept {
__base_10_u32(char* __first, uint32_t __value) _NOEXCEPT {
if (__value < 1000000) {
if (__value < 10000) {
if (__value < 100) {
Expand Down Expand Up @@ -110,7 +108,7 @@ __base_10_u32(char* __first, uint32_t __value) noexcept {
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char*
__base_10_u64(char* __buffer, uint64_t __value) noexcept {
__base_10_u64(char* __buffer, uint64_t __value) _NOEXCEPT {
if (__value <= UINT32_MAX)
return __itoa::__base_10_u32(__buffer, static_cast<uint32_t>(__value));

Expand All @@ -132,13 +130,13 @@ __base_10_u64(char* __buffer, uint64_t __value) noexcept {
/// \note The lookup table contains a partial set of exponents limiting the
/// range that can be used. However the range is sufficient for
/// \ref __base_10_u128.
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) noexcept {
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__exp >= __pow10_128_offset, "Index out of bounds");
return __pow10_128[__exp - __pow10_128_offset];
}

_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char*
__base_10_u128(char* __buffer, __uint128_t __value) noexcept {
__base_10_u128(char* __buffer, __uint128_t __value) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(
__value > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fails when this isn't true.");

Expand Down Expand Up @@ -179,8 +177,6 @@ __base_10_u128(char* __buffer, __uint128_t __value) noexcept {
# endif
} // namespace __itoa

#endif // _LIBCPP_STD_VER >= 17

_LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS
Expand Down
72 changes: 45 additions & 27 deletions libcxx/include/__charconv/to_chars_integral.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@ _LIBCPP_PUSH_MACROS

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 17

to_chars_result to_chars(char*, char*, bool, int = 10) = delete;

template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type);

template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) {
auto __x = std::__to_unsigned_like(__value);
if (__value < 0 && __first != __last) {
Expand All @@ -60,7 +56,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) {
}

template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) {
using __tx = __itoa::__traits<_Tp>;
auto __diff = __last - __first;
Expand All @@ -73,7 +69,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) {

# if _LIBCPP_HAS_INT128
template <>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) {
// When the value fits in 64-bits use the 64-bit code path. This reduces
// the number of expensive calculations on 128-bit values.
Expand All @@ -92,20 +88,20 @@ __to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) {
}
# endif

template <class _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type);
template <class _Tp, __enable_if_t<!is_signed<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base);

template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, true_type) {
template <class _Tp, __enable_if_t<is_signed<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base) {
auto __x = std::__to_unsigned_like(__value);
if (__value < 0 && __first != __last) {
*__first++ = '-';
__x = std::__complement(__x);
}

return std::__to_chars_integral(__first, __last, __x, __base, false_type());
return std::__to_chars_integral(__first, __last, __x, __base);
}

namespace __itoa {
Expand All @@ -116,15 +112,15 @@ struct _LIBCPP_HIDDEN __integral;
template <>
struct _LIBCPP_HIDDEN __integral<2> {
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int __width(_Tp __value) _NOEXCEPT {
// If value == 0 still need one digit. If the value != this has no
// effect since the code scans for the most significant bit set. (Note
// that __libcpp_clz doesn't work for 0.)
return numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1);
}

template <typename _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static __to_chars_result
__to_chars(char* __first, char* __last, _Tp __value) {
ptrdiff_t __cap = __last - __first;
int __n = __width(__value);
Expand Down Expand Up @@ -152,15 +148,15 @@ struct _LIBCPP_HIDDEN __integral<2> {
template <>
struct _LIBCPP_HIDDEN __integral<8> {
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int __width(_Tp __value) _NOEXCEPT {
// If value == 0 still need one digit. If the value != this has no
// effect since the code scans for the most significat bit set. (Note
// that __libcpp_clz doesn't work for 0.)
return ((numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1)) + 2) / 3;
}

template <typename _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static __to_chars_result
__to_chars(char* __first, char* __last, _Tp __value) {
ptrdiff_t __cap = __last - __first;
int __n = __width(__value);
Expand Down Expand Up @@ -188,15 +184,15 @@ struct _LIBCPP_HIDDEN __integral<8> {
template <>
struct _LIBCPP_HIDDEN __integral<16> {
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR int __width(_Tp __value) _NOEXCEPT {
// If value == 0 still need one digit. If the value != this has no
// effect since the code scans for the most significat bit set. (Note
// that __libcpp_clz doesn't work for 0.)
return (numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1) + 3) / 4;
}

template <typename _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static __to_chars_result
__to_chars(char* __first, char* __last, _Tp __value) {
ptrdiff_t __cap = __last - __first;
int __n = __width(__value);
Expand Down Expand Up @@ -235,13 +231,13 @@ _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_widt
}

template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) >= sizeof(unsigned)), int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value) {
return __itoa::__integral<_Base>::__to_chars(__first, __last, __value);
}

template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) < sizeof(unsigned)), int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value) {
return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value));
}
Expand Down Expand Up @@ -272,9 +268,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_widt
__libcpp_unreachable();
}

template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type) {
template <class _Tp, __enable_if_t<!is_signed<_Tp>::value, int> >
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base) {
if (__base == 10) [[likely]]
return std::__to_chars_itoa(__first, __last, __value, false_type());

Expand Down Expand Up @@ -302,6 +298,28 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_
return {__last, errc(0)};
}

_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 char __hex_to_upper(char __c) {
switch (__c) {
case 'a':
return 'A';
case 'b':
return 'B';
case 'c':
return 'C';
case 'd':
return 'D';
case 'e':
return 'E';
case 'f':
return 'F';
}
return __c;
}

#if _LIBCPP_STD_VER >= 17

to_chars_result to_chars(char*, char*, bool, int = 10) = delete;

template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
to_chars(char* __first, char* __last, _Tp __value) {
Expand All @@ -316,7 +334,7 @@ to_chars(char* __first, char* __last, _Tp __value, int __base) {
_LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]");

using _Type = __make_32_64_or_128_bit_t<_Tp>;
return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base, is_signed<_Tp>());
return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base);
}

#endif // _LIBCPP_STD_VER >= 17
Expand Down
9 changes: 9 additions & 0 deletions libcxx/include/__charconv/to_chars_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ struct _LIBCPP_EXPORTED_FROM_ABI to_chars_result {

#endif // _LIBCPP_STD_VER >= 17

struct __to_chars_result {
char* __ptr;
errc __ec;

#if _LIBCPP_STD_VER >= 17
_LIBCPP_HIDE_FROM_ABI constexpr operator to_chars_result() { return {__ptr, __ec}; }
#endif
};

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___CHARCONV_TO_CHARS_RESULT_H
Loading
Loading