29 #ifndef _STRING_CONVERSIONS_H 30 #define _STRING_CONVERSIONS_H 1 32 #pragma GCC system_header 34 #if __cplusplus < 201103L 46 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
51 template<
typename _TRet,
typename _Ret = _TRet,
typename _CharT,
54 __stoa(_TRet (*__convf) (
const _CharT*, _CharT**, _Base...),
55 const char* __name,
const _CharT* __str, std::size_t* __idx,
63 _Save_errno() : _M_errno(errno) { errno = 0; }
64 ~_Save_errno() {
if (errno == 0) errno = _M_errno; }
75 return __val < _TRet(__numeric_traits<int>::__min)
76 || __val > _TRet(__numeric_traits<int>::__max);
80 const _TRet __tmp = __convf(__str, &__endptr,
__base...);
82 if (__endptr == __str)
83 std::__throw_invalid_argument(__name);
84 else if (errno == ERANGE
86 std::__throw_out_of_range(__name);
91 *__idx = __endptr - __str;
97 template<
typename _String,
typename _CharT =
typename _String::value_type>
99 __to_xstring(
int (*__convf) (_CharT*, std::size_t,
const _CharT*,
100 __builtin_va_list), std::size_t __n,
101 const _CharT* __fmt, ...)
105 _CharT* __s =
static_cast<_CharT*
>(__builtin_alloca(
sizeof(_CharT)
108 __builtin_va_list __args;
109 __builtin_va_start(__args, __fmt);
111 const int __len = __convf(__s, __n, __fmt, __args);
113 __builtin_va_end(__args);
115 return _String(__s, __s + __len);
118 _GLIBCXX_END_NAMESPACE_VERSION
123 #endif // _STRING_CONVERSIONS_H
GNU extensions for public use.
_Iterator __base(_Iterator __it)