29#ifndef _STRING_CONVERSIONS_H
30#define _STRING_CONVERSIONS_H 1
33#pragma GCC system_header
38#if __cplusplus < 201103L
50namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
52_GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _TRet,
typename _Ret = _TRet,
typename _CharT,
58 __stoa(_TRet (*__convf) (
const _CharT*, _CharT**, _Base...),
59 const char* __name,
const _CharT* __str, std::size_t* __idx,
67 _Save_errno() : _M_errno(errno) { errno = 0; }
68 ~_Save_errno() {
if (errno == 0) errno = _M_errno; }
79 return __val < _TRet(__numeric_traits<int>::__min)
80 || __val > _TRet(__numeric_traits<int>::__max);
84 const _TRet __tmp = __convf(__str, &__endptr,
__base...);
86 if (__endptr == __str)
87 std::__throw_invalid_argument(__name);
88 else if (errno == ERANGE
89 || _Range_chk::_S_chk(__tmp, std::is_same<_Ret, int>{}))
90 std::__throw_out_of_range(__name);
95 *__idx = __endptr - __str;
101 template<
typename _String,
typename _CharT =
typename _String::value_type>
103 __to_xstring(
int (*__convf) (_CharT*, std::size_t,
const _CharT*,
104 __builtin_va_list), std::size_t __n,
105 const _CharT* __fmt, ...)
109 _CharT* __s =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
112 __builtin_va_list __args;
113 __builtin_va_start(__args, __fmt);
115 const int __len = __convf(__s, __n, __fmt, __args);
117 __builtin_va_end(__args);
119 return _String(__s, __s + __len);
122_GLIBCXX_END_NAMESPACE_VERSION
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
GNU extensions for public use.
constexpr _Iterator __base(_Iterator __it)