STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Namespaces | Macros | Functions
string File Reference
#include <istream>
#include <xstring_insert.h>

Namespaces

 literals
 
 literals::string_literals
 

Macros

#define _STRING_
 

Functions

template<class _Elem , class _Traits , class _Alloc >
_STD_BEGIN basic_istream< _Elem, _Traits > & operator>> (basic_istream< _Elem, _Traits > &&_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str)
 
template<class _Elem , class _Traits , class _Alloc >
basic_istream< _Elem, _Traits > & getline (basic_istream< _Elem, _Traits > &&_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str, const _Elem _Delim)
 
template<class _Elem , class _Traits , class _Alloc >
basic_istream< _Elem, _Traits > & getline (basic_istream< _Elem, _Traits > &&_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str)
 
template<class _Elem , class _Traits , class _Alloc >
basic_istream< _Elem, _Traits > & operator>> (basic_istream< _Elem, _Traits > &_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str)
 
template<class _Elem , class _Traits , class _Alloc >
basic_istream< _Elem, _Traits > & getline (basic_istream< _Elem, _Traits > &_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str, const _Elem _Delim)
 
template<class _Elem , class _Traits , class _Alloc >
basic_istream< _Elem, _Traits > & getline (basic_istream< _Elem, _Traits > &_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str)
 
template<class _Elem , class _Traits , class _Alloc >
basic_ostream< _Elem, _Traits > & operator<< (basic_ostream< _Elem, _Traits > &_Ostr, const basic_string< _Elem, _Traits, _Alloc > &_Str)
 
int stoi (const string &_Str, size_t *_Idx=0, int _Base=10)
 
long stol (const string &_Str, size_t *_Idx=0, int _Base=10)
 
unsigned long stoul (const string &_Str, size_t *_Idx=0, int _Base=10)
 
long long stoll (const string &_Str, size_t *_Idx=0, int _Base=10)
 
unsigned long long stoull (const string &_Str, size_t *_Idx=0, int _Base=10)
 
float stof (const string &_Str, size_t *_Idx=0)
 
double stod (const string &_Str, size_t *_Idx=0)
 
long double stold (const string &_Str, size_t *_Idx=0)
 
int stoi (const wstring &_Str, size_t *_Idx=0, int _Base=10)
 
long stol (const wstring &_Str, size_t *_Idx=0, int _Base=10)
 
unsigned long stoul (const wstring &_Str, size_t *_Idx=0, int _Base=10)
 
long long stoll (const wstring &_Str, size_t *_Idx=0, int _Base=10)
 
unsigned long long stoull (const wstring &_Str, size_t *_Idx=0, int _Base=10)
 
float stof (const wstring &_Str, size_t *_Idx=0)
 
double stod (const wstring &_Str, size_t *_Idx=0)
 
long double stold (const wstring &_Str, size_t *_Idx=0)
 
template<class _Elem , class _UTy >
_Elem * _UIntegral_to_buff (_Elem *_RNext, _UTy _UVal)
 
template<class _Elem , class _Ty >
basic_string< _Elem > _Integral_to_string (const _Ty _Val)
 
template<class _Ty >
string _Floating_to_string (const char *_Fmt, _Ty _Val)
 
template<class _Ty >
wstring _Floating_to_wstring (const wchar_t *_Fmt, _Ty _Val)
 
string to_string (int _Val)
 
string to_string (unsigned int _Val)
 
string to_string (long _Val)
 
string to_string (unsigned long _Val)
 
string to_string (long long _Val)
 
string to_string (unsigned long long _Val)
 
string to_string (float _Val)
 
string to_string (double _Val)
 
string to_string (long double _Val)
 
wstring to_wstring (int _Val)
 
wstring to_wstring (unsigned int _Val)
 
wstring to_wstring (long _Val)
 
wstring to_wstring (unsigned long _Val)
 
wstring to_wstring (long long _Val)
 
wstring to_wstring (unsigned long long _Val)
 
wstring to_wstring (float _Val)
 
wstring to_wstring (double _Val)
 
wstring to_wstring (long double _Val)
 
string literals::string_literals::operator""s (const char *_Str, size_t _Len)
 
wstring literals::string_literals::operator""s (const wchar_t *_Str, size_t _Len)
 
u32string literals::string_literals::operator""s (const char32_t *_Str, size_t _Len)
 

Macro Definition Documentation

#define _STRING_

Function Documentation

template<class _Ty >
string _Floating_to_string ( const char _Fmt,
_Ty  _Val 
)
inline
505  { // convert _Val to string
506  static_assert(is_floating_point<_Ty>::value,
507  "_Ty must be floating point");
508 
509  int _Len = _CSTD _scprintf(_Fmt, _Val);
510  string _Str(_Len + 1, '\0');
511  _CSTD sprintf_s(&_Str[0], _Len + 1, _Fmt, _Val);
512  _Str.resize(_Len);
513  return (_Str);
514  }
Definition: xtr1common:272
#define _CSTD
Definition: yvals.h:570
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty >
wstring _Floating_to_wstring ( const wchar_t _Fmt,
_Ty  _Val 
)
inline
518  { // convert _Val to wstring
519  static_assert(is_floating_point<_Ty>::value,
520  "_Ty must be floating point");
521 
522  int _Len = _CSTD _scwprintf(_Fmt, _Val);
523  wstring _Str(_Len + 1, L'\0');
524  _CSTD swprintf_s(&_Str[0], _Len + 1, _Fmt, _Val);
525  _Str.resize(_Len);
526  return (_Str);
527  }
Definition: xtr1common:272
#define _CSTD
Definition: yvals.h:570
Definition: xstring:1866
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Elem , class _Ty >
basic_string<_Elem> _Integral_to_string ( const _Ty  _Val)
inline
485  { // convert _Val to string
486  static_assert(is_integral<_Ty>::value, "_Ty must be integral");
487  using _UTy = make_unsigned_t<_Ty>;
488  _Elem _Buff[21]; // can hold -2^63 and 2^64 - 1, plus NUL
489  _Elem* const _Buff_end = _STD end(_Buff);
490  _Elem* _RNext = _Buff_end;
491  auto _UVal = static_cast<_UTy>(_Val);
492  if (_Val < 0)
493  {
494  _RNext = _UIntegral_to_buff(_RNext, 0 - _UVal);
495  *--_RNext = '-';
496  }
497  else
498  _RNext = _UIntegral_to_buff(_RNext, _UVal);
499 
500  return (basic_string<_Elem>(_RNext, _Buff_end));
501  }
directory_iterator end(const directory_iterator &) _NOEXCEPT
Definition: filesystem:1966
_Elem * _UIntegral_to_buff(_Elem *_RNext, _UTy _UVal)
Definition: string:444
Definition: xtr1common:237
Definition: xstring:1866
_FwdIt const _Ty _Val
Definition: algorithm:1938
typename make_unsigned< _Ty >::type make_unsigned_t
Definition: type_traits:2072
template<class _Elem , class _UTy >
_Elem* _UIntegral_to_buff ( _Elem *  _RNext,
_UTy  _UVal 
)
inline
445  { // format _UVal into buffer *ending at* _RNext
446  static_assert(is_unsigned<_UTy>::value, "_UTy must be unsigned");
447 
448 #ifdef _WIN64
449  auto _UVal_trunc = _UVal;
450 #else /* ^^^ _WIN64 ^^^ // vvv !_WIN64 vvv */
451 
452 #pragma warning(push)
453 #pragma warning(disable: 4127) // conditional expression is constant
454  if (sizeof(_UTy) > 4)
455  { // For 64-bit numbers, work in chunks to avoid 64-bit divisions.
456  while (_UVal > 0xFFFFFFFFU)
457  {
458  auto _UVal_chunk = static_cast<_Uint32t>(_UVal % 1000000000);
459  _UVal /= 1000000000;
460 
461  for (int _Idx = 0; _Idx != 9; ++_Idx)
462  {
463  *--_RNext = '0' + _UVal_chunk % 10;
464  _UVal_chunk /= 10;
465  }
466  }
467  }
468 #pragma warning(pop)
469 
470  auto _UVal_trunc = static_cast<_Uint32t>(_UVal);
471 #endif /* _WIN64 */
472 
473  do
474  {
475  *--_RNext = '0' + _UVal_trunc % 10;
476  _UVal_trunc /= 10;
477  }
478  while (_UVal_trunc != 0);
479  return (_RNext);
480  }
unsigned long _Uint32t
Definition: yvals.h:763
Definition: type_traits:806
template<class _Elem , class _Traits , class _Alloc >
basic_istream<_Elem, _Traits>& getline ( basic_istream< _Elem, _Traits > &&  _Istr,
basic_string< _Elem, _Traits, _Alloc > &  _Str,
const _Elem  _Delim 
)
inline
75  { // get characters into string, discard delimiter
76  typedef basic_istream<_Elem, _Traits> _Myis;
77 
78  ios_base::iostate _State = ios_base::goodbit;
79  bool _Changed = false;
80  const typename _Myis::sentry _Ok(_Istr, true);
81 
82  if (_Ok)
83  { // state okay, extract characters
85  _Str.erase();
86  const typename _Traits::int_type _Metadelim =
87  _Traits::to_int_type(_Delim);
88  typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();
89 
90  for (; ; _Meta = _Istr.rdbuf()->snextc())
91  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
92  { // end of file, quit
93  _State |= ios_base::eofbit;
94  break;
95  }
96  else if (_Traits::eq_int_type(_Meta, _Metadelim))
97  { // got a delimiter, discard it and quit
98  _Changed = true;
99  _Istr.rdbuf()->sbumpc();
100  break;
101  }
102  else if (_Str.max_size() <= _Str.size())
103  { // string too large, quit
104  _State |= ios_base::failbit;
105  break;
106  }
107  else
108  { // got a character, add it to string
109  _Str += _Traits::to_char_type(_Meta);
110  _Changed = true;
111  }
112  _CATCH_IO_(_Istr)
113  }
114 
115  if (!_Changed)
116  _State |= ios_base::failbit;
117  _Istr.setstate(_State);
118  return (_Istr);
119  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:153
static constexpr _Iostate failbit
Definition: xiosbase:88
#define _CATCH_IO_(x)
Definition: ostream:31
#define _TRY_IO_BEGIN
Definition: ostream:29
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:89
int_type __CLR_OR_THIS_CALL sbumpc()
Definition: streambuf:147
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _Inout_ mbstate_t * _State
Definition: wchar.h:78
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:165
_Myt & erase(const size_type _Off=0)
Definition: xstring:2584
size_type max_size() const _NOEXCEPT
Definition: xstring:3028
static constexpr _Iostate goodbit
Definition: xiosbase:86
size_type size() const _NOEXCEPT
Definition: xstring:3023
Definition: iosfwd:574
_Check_return_ _In_z_ unsigned char const * _Delim
Definition: mbstring.h:934
static constexpr _Iostate eofbit
Definition: xiosbase:87
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:55
template<class _Elem , class _Traits , class _Alloc >
basic_istream<_Elem, _Traits>& getline ( basic_istream< _Elem, _Traits > &&  _Istr,
basic_string< _Elem, _Traits, _Alloc > &  _Str 
)
inline
127  { // get characters into string, discard newline
128  return (getline(_Istr, _Str, _Istr.widen('\n')));
129  }
basic_istream< _Elem, _Traits > & getline(basic_istream< _Elem, _Traits > &&_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str, const _Elem _Delim)
Definition: string:71
_Elem __CLR_OR_THIS_CALL widen(char _Byte) const
Definition: ios:128
template<class _Elem , class _Traits , class _Alloc >
basic_istream<_Elem, _Traits>& getline ( basic_istream< _Elem, _Traits > &  _Istr,
basic_string< _Elem, _Traits, _Alloc > &  _Str,
const _Elem  _Delim 
)
inline
148  { // get characters into string, discard delimiter
149  return (getline(_STD move(_Istr), _Str, _Delim));
150  }
basic_istream< _Elem, _Traits > & getline(basic_istream< _Elem, _Traits > &&_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str, const _Elem _Delim)
Definition: string:71
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_Check_return_ _In_z_ unsigned char const * _Delim
Definition: mbstring.h:934
template<class _Elem , class _Traits , class _Alloc >
basic_istream<_Elem, _Traits>& getline ( basic_istream< _Elem, _Traits > &  _Istr,
basic_string< _Elem, _Traits, _Alloc > &  _Str 
)
inline
158  { // get characters into string, discard newline
159  return (getline(_STD move(_Istr), _Str, _Istr.widen('\n')));
160  }
basic_istream< _Elem, _Traits > & getline(basic_istream< _Elem, _Traits > &&_Istr, basic_string< _Elem, _Traits, _Alloc > &_Str, const _Elem _Delim)
Definition: string:71
_Elem __CLR_OR_THIS_CALL widen(char _Byte) const
Definition: ios:128
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
template<class _Elem , class _Traits , class _Alloc >
basic_ostream<_Elem, _Traits>& operator<< ( basic_ostream< _Elem, _Traits > &  _Ostr,
const basic_string< _Elem, _Traits, _Alloc > &  _Str 
)
inline
168  { // insert a string
169  return (_Insert_string(_Ostr, _Str.data(), _Str.size()));
170  }
_Ret_z_ const _Elem * data() const _NOEXCEPT
Definition: xstring:3006
_STD_BEGIN basic_ostream< _Elem, _Traits > & _Insert_string(basic_ostream< _Elem, _Traits > &_Ostr, const _Elem *const _Data, const _SizeT _Size)
Definition: xstring_insert.h:21
size_type size() const _NOEXCEPT
Definition: xstring:3023
template<class _Elem , class _Traits , class _Alloc >
_STD_BEGIN basic_istream<_Elem, _Traits>& operator>> ( basic_istream< _Elem, _Traits > &&  _Istr,
basic_string< _Elem, _Traits, _Alloc > &  _Str 
)
inline
23  { // extract a string
24  typedef ctype<_Elem> _Ctype;
25  typedef basic_istream<_Elem, _Traits> _Myis;
27  typedef typename _Mystr::size_type _Mysizt;
28 
29  ios_base::iostate _State = ios_base::goodbit;
30  bool _Changed = false;
31  const typename _Myis::sentry _Ok(_Istr);
32 
33  if (_Ok)
34  { // state okay, extract characters
35  const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
36  _Str.erase();
37 
39  _Mysizt _Size = 0 < _Istr.width()
40  && (_Mysizt)_Istr.width() < _Str.max_size()
41  ? (_Mysizt)_Istr.width() : _Str.max_size();
42  typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();
43 
44  for (; 0 < _Size; --_Size, _Meta = _Istr.rdbuf()->snextc())
45  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
46  { // end of file, quit
47  _State |= ios_base::eofbit;
48  break;
49  }
50  else if (_Ctype_fac.is(_Ctype::space,
51  _Traits::to_char_type(_Meta)))
52  break; // whitespace, quit
53  else
54  { // add character to string
55  _Str.append(1, _Traits::to_char_type(_Meta));
56  _Changed = true;
57  }
58  _CATCH_IO_(_Istr)
59  }
60 
61  _Istr.width(0);
62  if (!_Changed)
63  _State |= ios_base::failbit;
64  _Istr.setstate(_State);
65  return (_Istr);
66  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:153
static constexpr _Iostate failbit
Definition: xiosbase:88
#define _CATCH_IO_(x)
Definition: ostream:31
#define _USE(loc, fac)
Definition: xlocale:499
_CRT_BEGIN_C_HEADER _Check_return_ _Ret_maybenull_ _In_ size_t _Size
Definition: corecrt_malloc.h:58
#define _TRY_IO_BEGIN
Definition: ostream:29
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:432
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:89
_Myt & append(initializer_list< _Elem > _Ilist)
Definition: xstring:2199
Definition: xlocale:2077
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _Inout_ mbstate_t * _State
Definition: wchar.h:78
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:165
streamsize __CLR_OR_THIS_CALL width() const
Definition: xiosbase:420
_Myt & erase(const size_type _Off=0)
Definition: xstring:2584
size_type max_size() const _NOEXCEPT
Definition: xstring:3028
static constexpr _Iostate goodbit
Definition: xiosbase:86
space_info space(const path &)
Definition: filesystem:3117
Definition: iosfwd:574
Definition: xstring:1866
static constexpr _Iostate eofbit
Definition: xiosbase:87
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:55
template<class _Elem , class _Traits , class _Alloc >
basic_istream<_Elem, _Traits>& operator>> ( basic_istream< _Elem, _Traits > &  _Istr,
basic_string< _Elem, _Traits, _Alloc > &  _Str 
)
inline
137  { // extract a string
138  return (_STD move(_Istr) >> _Str);
139  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
double stod ( const string _Str,
size_t _Idx = 0 
)
inline
276  { // convert string to double
277  const char *_Ptr = _Str.c_str();
278  char *_Eptr;
279  errno = 0;
280  double _Ans = _CSTD strtod(_Ptr, &_Eptr);
281 
282  if (_Ptr == _Eptr)
283  _Xinvalid_argument("invalid stod argument");
284  if (errno == ERANGE)
285  _Xout_of_range("stod argument out of range");
286  if (_Idx != 0)
287  *_Idx = (size_t)(_Eptr - _Ptr);
288  return (_Ans);
289  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
_Check_return_ _ACRTIMP double __cdecl strtod(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr)
#define errno
Definition: errno.h:19
double stod ( const wstring _Str,
size_t _Idx = 0 
)
inline
410  { // convert wstring to double
411  const wchar_t *_Ptr = _Str.c_str();
412  wchar_t *_Eptr;
413  errno = 0;
414  double _Ans = _CSTD wcstod(_Ptr, &_Eptr);
415 
416  if (_Ptr == _Eptr)
417  _Xinvalid_argument("invalid stod argument");
418  if (errno == ERANGE)
419  _Xout_of_range("stod argument out of range");
420  if (_Idx != 0)
421  *_Idx = (size_t)(_Eptr - _Ptr);
422  return (_Ans);
423  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
_In_ unsigned _Pre_notnull_ _In_ _Radix _Check_return_ _ACRTIMP double __cdecl wcstod(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr)
#define errno
Definition: errno.h:19
float stof ( const string _Str,
size_t _Idx = 0 
)
inline
260  { // convert string to float
261  const char *_Ptr = _Str.c_str();
262  char *_Eptr;
263  errno = 0;
264  float _Ans = _CSTD strtof(_Ptr, &_Eptr);
265 
266  if (_Ptr == _Eptr)
267  _Xinvalid_argument("invalid stof argument");
268  if (errno == ERANGE)
269  _Xout_of_range("stof argument out of range");
270  if (_Idx != 0)
271  *_Idx = (size_t)(_Eptr - _Ptr);
272  return (_Ans);
273  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_Check_return_ _ACRTIMP float __cdecl strtof(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
float stof ( const wstring _Str,
size_t _Idx = 0 
)
inline
394  { // convert wstring to float
395  const wchar_t *_Ptr = _Str.c_str();
396  wchar_t *_Eptr;
397  errno = 0;
398  float _Ans = _CSTD wcstof(_Ptr, &_Eptr);
399 
400  if (_Ptr == _Eptr)
401  _Xinvalid_argument("invalid stof argument");
402  if (errno == ERANGE)
403  _Xout_of_range("stof argument out of range");
404  if (_Idx != 0)
405  *_Idx = (size_t)(_Eptr - _Ptr);
406  return (_Ans);
407  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_Check_return_ _ACRTIMP float __cdecl wcstof(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
int stoi ( const string _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
176  { // convert string to int
177  const char *_Ptr = _Str.c_str();
178  char *_Eptr;
179  errno = 0;
180  long _Ans = _CSTD strtol(_Ptr, &_Eptr, _Base);
181 
182  if (_Ptr == _Eptr)
183  _Xinvalid_argument("invalid stoi argument");
184  if (errno == ERANGE || _Ans < INT_MIN || INT_MAX < _Ans)
185  _Xout_of_range("stoi argument out of range");
186  if (_Idx != 0)
187  *_Idx = (size_t)(_Eptr - _Ptr);
188  return ((int)_Ans);
189  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_Check_return_ _ACRTIMP long __cdecl strtol(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define INT_MIN
Definition: limits.h:34
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define INT_MAX
Definition: limits.h:35
#define errno
Definition: errno.h:19
int stoi ( const wstring _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
310  { // convert wstring to int
311  const wchar_t *_Ptr = _Str.c_str();
312  wchar_t *_Eptr;
313  errno = 0;
314  long _Ans = _CSTD wcstol(_Ptr, &_Eptr, _Base);
315 
316  if (_Ptr == _Eptr)
317  _Xinvalid_argument("invalid stoi argument");
318  if (errno == ERANGE || _Ans < INT_MIN || INT_MAX < _Ans)
319  _Xout_of_range("stoi argument out of range");
320  if (_Idx != 0)
321  *_Idx = (size_t)(_Eptr - _Ptr);
322  return ((int)_Ans);
323  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_Check_return_ _ACRTIMP long __cdecl wcstol(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_In_ int _Base
Definition: time.h:323
#define INT_MIN
Definition: limits.h:34
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define INT_MAX
Definition: limits.h:35
#define errno
Definition: errno.h:19
long stol ( const string _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
193  { // convert string to long
194  const char *_Ptr = _Str.c_str();
195  char *_Eptr;
196  errno = 0;
197  long _Ans = _CSTD strtol(_Ptr, &_Eptr, _Base);
198 
199  if (_Ptr == _Eptr)
200  _Xinvalid_argument("invalid stol argument");
201  if (errno == ERANGE)
202  _Xout_of_range("stol argument out of range");
203  if (_Idx != 0)
204  *_Idx = (size_t)(_Eptr - _Ptr);
205  return (_Ans);
206  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_Check_return_ _ACRTIMP long __cdecl strtol(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
long stol ( const wstring _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
327  { // convert wstring to long
328  const wchar_t *_Ptr = _Str.c_str();
329  wchar_t *_Eptr;
330  errno = 0;
331  long _Ans = _CSTD wcstol(_Ptr, &_Eptr, _Base);
332 
333  if (_Ptr == _Eptr)
334  _Xinvalid_argument("invalid stol argument");
335  if (errno == ERANGE)
336  _Xout_of_range("stol argument out of range");
337  if (_Idx != 0)
338  *_Idx = (size_t)(_Eptr - _Ptr);
339  return (_Ans);
340  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_Check_return_ _ACRTIMP long __cdecl wcstol(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
long double stold ( const string _Str,
size_t _Idx = 0 
)
inline
292  { // convert string to long double
293  const char *_Ptr = _Str.c_str();
294  char *_Eptr;
295  errno = 0;
296  long double _Ans = _CSTD strtold(_Ptr, &_Eptr);
297 
298  if (_Ptr == _Eptr)
299  _Xinvalid_argument("invalid stold argument");
300  if (errno == ERANGE)
301  _Xout_of_range("stold argument out of range");
302  if (_Idx != 0)
303  *_Idx = (size_t)(_Eptr - _Ptr);
304  return (_Ans);
305  }
_Check_return_ _ACRTIMP long double __cdecl strtold(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr)
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
long double stold ( const wstring _Str,
size_t _Idx = 0 
)
inline
426  { // convert wstring to long double
427  const wchar_t *_Ptr = _Str.c_str();
428  wchar_t *_Eptr;
429  errno = 0;
430  long double _Ans = _CSTD wcstold(_Ptr, &_Eptr);
431 
432  if (_Ptr == _Eptr)
433  _Xinvalid_argument("invalid stold argument");
434  if (errno == ERANGE)
435  _Xout_of_range("stold argument out of range");
436  if (_Idx != 0)
437  *_Idx = (size_t)(_Eptr - _Ptr);
438  return (_Ans);
439  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
_Check_return_ _ACRTIMP long double __cdecl wcstold(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
long long stoll ( const string _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
227  { // convert string to long long
228  const char *_Ptr = _Str.c_str();
229  char *_Eptr;
230  errno = 0;
231  long long _Ans = _CSTD strtoll(_Ptr, &_Eptr, _Base);
232 
233  if (_Ptr == _Eptr)
234  _Xinvalid_argument("invalid stoll argument");
235  if (errno == ERANGE)
236  _Xout_of_range("stoll argument out of range");
237  if (_Idx != 0)
238  *_Idx = (size_t)(_Eptr - _Ptr);
239  return (_Ans);
240  }
_Check_return_ _ACRTIMP long long __cdecl strtoll(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
long long stoll ( const wstring _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
361  { // convert wstring to long long
362  const wchar_t *_Ptr = _Str.c_str();
363  wchar_t *_Eptr;
364  errno = 0;
365  long long _Ans = _CSTD wcstoll(_Ptr, &_Eptr, _Base);
366 
367  if (_Ptr == _Eptr)
368  _Xinvalid_argument("invalid stoll argument");
369  if (errno == ERANGE)
370  _Xout_of_range("stoll argument out of range");
371  if (_Idx != 0)
372  *_Idx = (size_t)(_Eptr - _Ptr);
373  return (_Ans);
374  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
_Check_return_ _ACRTIMP long long __cdecl wcstoll(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
unsigned long stoul ( const string _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
210  { // convert string to unsigned long
211  const char *_Ptr = _Str.c_str();
212  char *_Eptr;
213  errno = 0;
214  unsigned long _Ans = _CSTD strtoul(_Ptr, &_Eptr, _Base);
215 
216  if (_Ptr == _Eptr)
217  _Xinvalid_argument("invalid stoul argument");
218  if (errno == ERANGE)
219  _Xout_of_range("stoul argument out of range");
220  if (_Idx != 0)
221  *_Idx = (size_t)(_Eptr - _Ptr);
222  return (_Ans);
223  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
_Check_return_ _ACRTIMP unsigned long __cdecl strtoul(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
unsigned long stoul ( const wstring _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
344  { // convert wstring to unsigned long
345  const wchar_t *_Ptr = _Str.c_str();
346  wchar_t *_Eptr;
347  errno = 0;
348  unsigned long _Ans = _CSTD wcstoul(_Ptr, &_Eptr, _Base);
349 
350  if (_Ptr == _Eptr)
351  _Xinvalid_argument("invalid stoul argument");
352  if (errno == ERANGE)
353  _Xout_of_range("stoul argument out of range");
354  if (_Idx != 0)
355  *_Idx = (size_t)(_Eptr - _Ptr);
356  return (_Ans);
357  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_Check_return_ _ACRTIMP unsigned long __cdecl wcstoul(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
unsigned long long stoull ( const string _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
244  { // convert string to unsigned long long
245  const char *_Ptr = _Str.c_str();
246  char *_Eptr;
247  errno = 0;
248  unsigned long long _Ans = _CSTD strtoull(_Ptr, &_Eptr, _Base);
249 
250  if (_Ptr == _Eptr)
251  _Xinvalid_argument("invalid stoull argument");
252  if (errno == ERANGE)
253  _Xout_of_range("stoull argument out of range");
254  if (_Idx != 0)
255  *_Idx = (size_t)(_Eptr - _Ptr);
256  return (_Ans);
257  }
_Check_return_ _ACRTIMP unsigned long long __cdecl strtoull(_In_z_ char const *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
#define errno
Definition: errno.h:19
unsigned long long stoull ( const wstring _Str,
size_t _Idx = 0,
int  _Base = 10 
)
inline
378  { // convert wstring to unsigned long long
379  const wchar_t *_Ptr = _Str.c_str();
380  wchar_t *_Eptr;
381  errno = 0;
382  unsigned long long _Ans = _CSTD wcstoull(_Ptr, &_Eptr, _Base);
383 
384  if (_Ptr == _Eptr)
385  _Xinvalid_argument("invalid stoull argument");
386  if (errno == ERANGE)
387  _Xout_of_range("stoull argument out of range");
388  if (_Idx != 0)
389  *_Idx = (size_t)(_Eptr - _Ptr);
390  return (_Ans);
391  }
_Ret_z_ const _Elem * c_str() const _NOEXCEPT
Definition: xstring:3001
unsigned int size_t
Definition: sourceannotations.h:19
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *)
#define ERANGE
Definition: errno.h:74
_In_ int _Base
Definition: time.h:323
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
#define _CSTD
Definition: yvals.h:570
_Check_return_ _ACRTIMP unsigned long long __cdecl wcstoull(_In_z_ wchar_t const *_String, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define errno
Definition: errno.h:19
string to_string ( int  _Val)
inline
533  { // convert int to string
534  return (_Integral_to_string<char>(_Val));
535  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( unsigned int  _Val)
inline
538  { // convert unsigned int to string
539  return (_Integral_to_string<char>(_Val));
540  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( long  _Val)
inline
543  { // convert long to string
544  return (_Integral_to_string<char>(_Val));
545  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( unsigned long  _Val)
inline
548  { // convert unsigned long to string
549  return (_Integral_to_string<char>(_Val));
550  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( long long  _Val)
inline
553  { // convert long long to string
554  return (_Integral_to_string<char>(_Val));
555  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( unsigned long long  _Val)
inline
558  { // convert unsigned long long to string
559  return (_Integral_to_string<char>(_Val));
560  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( float  _Val)
inline
563  { // convert float to string
564  return (_Floating_to_string("%f", _Val));
565  }
string _Floating_to_string(const char *_Fmt, _Ty _Val)
Definition: string:504
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( double  _Val)
inline
568  { // convert double to string
569  return (_Floating_to_string("%f", _Val));
570  }
string _Floating_to_string(const char *_Fmt, _Ty _Val)
Definition: string:504
_FwdIt const _Ty _Val
Definition: algorithm:1938
string to_string ( long double  _Val)
inline
573  { // convert long double to string
574  return (_Floating_to_string("%Lf", _Val));
575  }
string _Floating_to_string(const char *_Fmt, _Ty _Val)
Definition: string:504
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( int  _Val)
inline
579  { // convert int to wstring
580  return (_Integral_to_string<wchar_t>(_Val));
581  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( unsigned int  _Val)
inline
584  { // convert unsigned int to wstring
585  return (_Integral_to_string<wchar_t>(_Val));
586  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( long  _Val)
inline
589  { // convert long to wstring
590  return (_Integral_to_string<wchar_t>(_Val));
591  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( unsigned long  _Val)
inline
594  { // convert unsigned long to wstring
595  return (_Integral_to_string<wchar_t>(_Val));
596  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( long long  _Val)
inline
599  { // convert long long to wstring
600  return (_Integral_to_string<wchar_t>(_Val));
601  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( unsigned long long  _Val)
inline
604  { // convert unsigned long long to wstring
605  return (_Integral_to_string<wchar_t>(_Val));
606  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( float  _Val)
inline
609  { // convert float to wstring
610  return (_Floating_to_wstring(L"%f", _Val));
611  }
wstring _Floating_to_wstring(const wchar_t *_Fmt, _Ty _Val)
Definition: string:517
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( double  _Val)
inline
614  { // convert double to wstring
615  return (_Floating_to_wstring(L"%f", _Val));
616  }
wstring _Floating_to_wstring(const wchar_t *_Fmt, _Ty _Val)
Definition: string:517
_FwdIt const _Ty _Val
Definition: algorithm:1938
wstring to_wstring ( long double  _Val)
inline
619  { // convert long double to wstring
620  return (_Floating_to_wstring(L"%Lf", _Val));
621  }
wstring _Floating_to_wstring(const wchar_t *_Fmt, _Ty _Val)
Definition: string:517
_FwdIt const _Ty _Val
Definition: algorithm:1938