blob: 608dcb2c5863f8f6f66d88d12535699cc404609c [file] [log] [blame]
Louis Dionne9bd93882021-11-17 16:25:01 -05001//===----------------------------------------------------------------------===//
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +00002//
Chandler Carruthd2012102019-01-19 10:56:40 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "string"
Marshall Clow54e41492019-06-10 23:20:01 +000010#include "charconv"
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000011#include "cstdlib"
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000012#include "cerrno"
Howard Hinnantae2378a2013-05-16 17:13:40 +000013#include "limits"
14#include "stdexcept"
Howard Hinnant84f697e2013-07-23 16:05:56 +000015#include <stdio.h>
Marshall Clow54e41492019-06-10 23:20:01 +000016#include "__debug"
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000017
Louis Dionne89258142021-08-23 15:32:36 -040018#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
19# include "cwchar"
20#endif
21
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000022_LIBCPP_BEGIN_NAMESPACE_STD
23
Louis Dionneb6aabd92021-08-19 12:21:06 -040024void __basic_string_common<true>::__throw_length_error() const {
25 _VSTD::__throw_length_error("basic_string");
26}
27
28void __basic_string_common<true>::__throw_out_of_range() const {
29 _VSTD::__throw_out_of_range("basic_string");
30}
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000031
Louis Dionne732192e2021-06-09 09:41:27 -040032#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
Martijn Velsb17d5802020-03-02 10:11:35 -050033#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
Louis Dionne89258142021-08-23 15:32:36 -040034 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
35# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
36 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
37# endif
Martijn Vels1e63ba02020-02-19 16:27:50 -050038#else
Louis Dionne89258142021-08-23 15:32:36 -040039 _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
40# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
41 _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
42# endif
Martijn Vels1e63ba02020-02-19 16:27:50 -050043#endif
Louis Dionne732192e2021-06-09 09:41:27 -040044#undef _LIBCPP_EXTERN_TEMPLATE_DEFINE
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000045
Louis Dionne732192e2021-06-09 09:41:27 -040046template string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&);
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +000047
Howard Hinnantae2378a2013-05-16 17:13:40 +000048namespace
49{
50
51template<typename T>
52inline
53void throw_helper( const string& msg )
54{
55#ifndef _LIBCPP_NO_EXCEPTIONS
56 throw T( msg );
57#else
Ed Schouten7a441452015-03-10 07:57:43 +000058 fprintf(stderr, "%s\n", msg.c_str());
Marshall Clow8fea1612016-08-25 15:09:01 +000059 _VSTD::abort();
Howard Hinnantae2378a2013-05-16 17:13:40 +000060#endif
61}
62
63inline
64void throw_from_string_out_of_range( const string& func )
65{
66 throw_helper<out_of_range>(func + ": out of range");
67}
68
69inline
70void throw_from_string_invalid_arg( const string& func )
71{
72 throw_helper<invalid_argument>(func + ": no conversion");
73}
74
75// as_integer
76
77template<typename V, typename S, typename F>
78inline
79V
80as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f)
81{
Eric Fiselier002dc672014-11-14 22:23:57 +000082 typename S::value_type* ptr = nullptr;
Howard Hinnantae2378a2013-05-16 17:13:40 +000083 const typename S::value_type* const p = str.c_str();
84 typename remove_reference<decltype(errno)>::type errno_save = errno;
85 errno = 0;
86 V r = f(p, &ptr, base);
87 swap(errno, errno_save);
88 if (errno_save == ERANGE)
89 throw_from_string_out_of_range(func);
90 if (ptr == p)
91 throw_from_string_invalid_arg(func);
92 if (idx)
93 *idx = static_cast<size_t>(ptr - p);
94 return r;
95}
96
97template<typename V, typename S>
98inline
99V
100as_integer(const string& func, const S& s, size_t* idx, int base);
101
102// string
103template<>
104inline
105int
106as_integer(const string& func, const string& s, size_t* idx, int base )
107{
Joerg Sonnenbergere211bc02013-09-17 08:46:53 +0000108 // Use long as no Standard string to integer exists.
Howard Hinnantae2378a2013-05-16 17:13:40 +0000109 long r = as_integer_helper<long>( func, s, idx, base, strtol );
110 if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
111 throw_from_string_out_of_range(func);
112 return static_cast<int>(r);
113}
114
115template<>
116inline
117long
118as_integer(const string& func, const string& s, size_t* idx, int base )
119{
120 return as_integer_helper<long>( func, s, idx, base, strtol );
121}
122
123template<>
124inline
125unsigned long
126as_integer( const string& func, const string& s, size_t* idx, int base )
127{
128 return as_integer_helper<unsigned long>( func, s, idx, base, strtoul );
129}
130
131template<>
132inline
133long long
134as_integer( const string& func, const string& s, size_t* idx, int base )
135{
136 return as_integer_helper<long long>( func, s, idx, base, strtoll );
137}
138
139template<>
140inline
141unsigned long long
142as_integer( const string& func, const string& s, size_t* idx, int base )
143{
144 return as_integer_helper<unsigned long long>( func, s, idx, base, strtoull );
145}
146
Louis Dionne89258142021-08-23 15:32:36 -0400147#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnantae2378a2013-05-16 17:13:40 +0000148// wstring
149template<>
150inline
151int
152as_integer( const string& func, const wstring& s, size_t* idx, int base )
153{
154 // Use long as no Stantard string to integer exists.
155 long r = as_integer_helper<long>( func, s, idx, base, wcstol );
156 if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
157 throw_from_string_out_of_range(func);
158 return static_cast<int>(r);
159}
160
161template<>
162inline
163long
164as_integer( const string& func, const wstring& s, size_t* idx, int base )
165{
166 return as_integer_helper<long>( func, s, idx, base, wcstol );
167}
168
169template<>
170inline
171unsigned long
172as_integer( const string& func, const wstring& s, size_t* idx, int base )
173{
174 return as_integer_helper<unsigned long>( func, s, idx, base, wcstoul );
175}
176
177template<>
178inline
179long long
180as_integer( const string& func, const wstring& s, size_t* idx, int base )
181{
182 return as_integer_helper<long long>( func, s, idx, base, wcstoll );
183}
184
185template<>
186inline
187unsigned long long
188as_integer( const string& func, const wstring& s, size_t* idx, int base )
189{
190 return as_integer_helper<unsigned long long>( func, s, idx, base, wcstoull );
191}
Louis Dionne89258142021-08-23 15:32:36 -0400192#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnantae2378a2013-05-16 17:13:40 +0000193
194// as_float
195
Marshall Clow54e41492019-06-10 23:20:01 +0000196template<typename V, typename S, typename F>
Howard Hinnantae2378a2013-05-16 17:13:40 +0000197inline
198V
199as_float_helper(const string& func, const S& str, size_t* idx, F f )
200{
Eric Fiselier002dc672014-11-14 22:23:57 +0000201 typename S::value_type* ptr = nullptr;
Howard Hinnantae2378a2013-05-16 17:13:40 +0000202 const typename S::value_type* const p = str.c_str();
203 typename remove_reference<decltype(errno)>::type errno_save = errno;
204 errno = 0;
205 V r = f(p, &ptr);
206 swap(errno, errno_save);
207 if (errno_save == ERANGE)
208 throw_from_string_out_of_range(func);
209 if (ptr == p)
210 throw_from_string_invalid_arg(func);
211 if (idx)
212 *idx = static_cast<size_t>(ptr - p);
213 return r;
214}
215
216template<typename V, typename S>
217inline
218V as_float( const string& func, const S& s, size_t* idx = nullptr );
219
220template<>
221inline
222float
223as_float( const string& func, const string& s, size_t* idx )
224{
225 return as_float_helper<float>( func, s, idx, strtof );
226}
227
228template<>
229inline
230double
231as_float(const string& func, const string& s, size_t* idx )
232{
233 return as_float_helper<double>( func, s, idx, strtod );
234}
235
236template<>
237inline
238long double
239as_float( const string& func, const string& s, size_t* idx )
240{
241 return as_float_helper<long double>( func, s, idx, strtold );
242}
243
Louis Dionne89258142021-08-23 15:32:36 -0400244#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnantae2378a2013-05-16 17:13:40 +0000245template<>
246inline
247float
248as_float( const string& func, const wstring& s, size_t* idx )
249{
250 return as_float_helper<float>( func, s, idx, wcstof );
251}
252
253template<>
254inline
255double
256as_float( const string& func, const wstring& s, size_t* idx )
257{
258 return as_float_helper<double>( func, s, idx, wcstod );
259}
260
261template<>
262inline
263long double
264as_float( const string& func, const wstring& s, size_t* idx )
265{
266 return as_float_helper<long double>( func, s, idx, wcstold );
267}
Louis Dionne89258142021-08-23 15:32:36 -0400268#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnantae2378a2013-05-16 17:13:40 +0000269
270} // unnamed namespace
271
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000272int
273stoi(const string& str, size_t* idx, int base)
274{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000275 return as_integer<int>( "stoi", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000276}
277
Louis Dionne89258142021-08-23 15:32:36 -0400278#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000279int
280stoi(const wstring& str, size_t* idx, int base)
281{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000282 return as_integer<int>( "stoi", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000283}
Louis Dionne89258142021-08-23 15:32:36 -0400284#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000285
286long
287stol(const string& str, size_t* idx, int base)
288{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000289 return as_integer<long>( "stol", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000290}
291
Louis Dionne89258142021-08-23 15:32:36 -0400292#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000293long
294stol(const wstring& str, size_t* idx, int base)
295{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000296 return as_integer<long>( "stol", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000297}
Louis Dionne89258142021-08-23 15:32:36 -0400298#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000299
300unsigned long
301stoul(const string& str, size_t* idx, int base)
302{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000303 return as_integer<unsigned long>( "stoul", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000304}
305
Louis Dionne89258142021-08-23 15:32:36 -0400306#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000307unsigned long
308stoul(const wstring& str, size_t* idx, int base)
309{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000310 return as_integer<unsigned long>( "stoul", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000311}
Louis Dionne89258142021-08-23 15:32:36 -0400312#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000313
314long long
315stoll(const string& str, size_t* idx, int base)
316{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000317 return as_integer<long long>( "stoll", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000318}
319
Louis Dionne89258142021-08-23 15:32:36 -0400320#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000321long long
322stoll(const wstring& str, size_t* idx, int base)
323{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000324 return as_integer<long long>( "stoll", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000325}
Louis Dionne89258142021-08-23 15:32:36 -0400326#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000327
328unsigned long long
329stoull(const string& str, size_t* idx, int base)
330{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000331 return as_integer<unsigned long long>( "stoull", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000332}
333
Louis Dionne89258142021-08-23 15:32:36 -0400334#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000335unsigned long long
336stoull(const wstring& str, size_t* idx, int base)
337{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000338 return as_integer<unsigned long long>( "stoull", str, idx, base );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000339}
Louis Dionne89258142021-08-23 15:32:36 -0400340#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000341
342float
343stof(const string& str, size_t* idx)
344{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000345 return as_float<float>( "stof", str, idx );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000346}
347
Louis Dionne89258142021-08-23 15:32:36 -0400348#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000349float
350stof(const wstring& str, size_t* idx)
351{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000352 return as_float<float>( "stof", str, idx );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000353}
Louis Dionne89258142021-08-23 15:32:36 -0400354#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000355
356double
357stod(const string& str, size_t* idx)
358{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000359 return as_float<double>( "stod", str, idx );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000360}
361
Louis Dionne89258142021-08-23 15:32:36 -0400362#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000363double
364stod(const wstring& str, size_t* idx)
365{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000366 return as_float<double>( "stod", str, idx );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000367}
Louis Dionne89258142021-08-23 15:32:36 -0400368#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000369
370long double
371stold(const string& str, size_t* idx)
372{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000373 return as_float<long double>( "stold", str, idx );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000374}
375
Louis Dionne89258142021-08-23 15:32:36 -0400376#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000377long double
378stold(const wstring& str, size_t* idx)
379{
Howard Hinnantae2378a2013-05-16 17:13:40 +0000380 return as_float<long double>( "stold", str, idx );
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000381}
Louis Dionne89258142021-08-23 15:32:36 -0400382#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000383
Howard Hinnantae2378a2013-05-16 17:13:40 +0000384// to_string
385
386namespace
387{
388
389// as_string
390
391template<typename S, typename P, typename V >
392inline
393S
394as_string(P sprintf_like, S s, const typename S::value_type* fmt, V a)
395{
396 typedef typename S::size_type size_type;
397 size_type available = s.size();
398 while (true)
399 {
400 int status = sprintf_like(&s[0], available + 1, fmt, a);
401 if ( status >= 0 )
402 {
403 size_type used = static_cast<size_type>(status);
404 if ( used <= available )
405 {
406 s.resize( used );
407 break;
408 }
409 available = used; // Assume this is advice of how much space we need.
410 }
411 else
412 available = available * 2 + 1;
413 s.resize(available);
414 }
415 return s;
416}
417
Marshall Clow54e41492019-06-10 23:20:01 +0000418template <class S>
Howard Hinnantae2378a2013-05-16 17:13:40 +0000419struct initial_string;
420
Marshall Clow54e41492019-06-10 23:20:01 +0000421template <>
422struct initial_string<string>
Howard Hinnantae2378a2013-05-16 17:13:40 +0000423{
424 string
425 operator()() const
426 {
427 string s;
428 s.resize(s.capacity());
429 return s;
430 }
431};
432
Louis Dionne89258142021-08-23 15:32:36 -0400433#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Marshall Clow54e41492019-06-10 23:20:01 +0000434template <>
435struct initial_string<wstring>
Howard Hinnantae2378a2013-05-16 17:13:40 +0000436{
437 wstring
438 operator()() const
439 {
440 wstring s(20, wchar_t());
441 s.resize(s.capacity());
442 return s;
443 }
444};
445
446typedef int (*wide_printf)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...);
447
448inline
449wide_printf
450get_swprintf()
451{
Howard Hinnant13d8bc12013-08-01 18:17:34 +0000452#ifndef _LIBCPP_MSVCRT
Howard Hinnantae2378a2013-05-16 17:13:40 +0000453 return swprintf;
454#else
Eric Fiselier4a984f02017-05-10 20:57:45 +0000455 return static_cast<int (__cdecl*)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...)>(_snwprintf);
Howard Hinnantae2378a2013-05-16 17:13:40 +0000456#endif
457}
Louis Dionne89258142021-08-23 15:32:36 -0400458#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
Howard Hinnantae2378a2013-05-16 17:13:40 +0000459
Marshall Clow54e41492019-06-10 23:20:01 +0000460template <typename S, typename V>
Louis Dionned9f528e2021-06-29 13:52:26 -0400461S i_to_string(V v)
Marshall Clow54e41492019-06-10 23:20:01 +0000462{
463// numeric_limits::digits10 returns value less on 1 than desired for unsigned numbers.
464// For example, for 1-byte unsigned value digits10 is 2 (999 can not be represented),
465// so we need +1 here.
466 constexpr size_t bufsize = numeric_limits<V>::digits10 + 2; // +1 for minus, +1 for digits10
467 char buf[bufsize];
468 const auto res = to_chars(buf, buf + bufsize, v);
469 _LIBCPP_ASSERT(res.ec == errc(), "bufsize must be large enough to accomodate the value");
470 return S(buf, res.ptr);
471}
472
Howard Hinnantae2378a2013-05-16 17:13:40 +0000473} // unnamed namespace
474
Marshall Clow54e41492019-06-10 23:20:01 +0000475string to_string (int val) { return i_to_string< string>(val); }
476string to_string (long val) { return i_to_string< string>(val); }
477string to_string (long long val) { return i_to_string< string>(val); }
478string to_string (unsigned val) { return i_to_string< string>(val); }
479string to_string (unsigned long val) { return i_to_string< string>(val); }
480string to_string (unsigned long long val) { return i_to_string< string>(val); }
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000481
Louis Dionne89258142021-08-23 15:32:36 -0400482#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Marshall Clow54e41492019-06-10 23:20:01 +0000483wstring to_wstring(int val) { return i_to_string<wstring>(val); }
484wstring to_wstring(long val) { return i_to_string<wstring>(val); }
485wstring to_wstring(long long val) { return i_to_string<wstring>(val); }
486wstring to_wstring(unsigned val) { return i_to_string<wstring>(val); }
487wstring to_wstring(unsigned long val) { return i_to_string<wstring>(val); }
488wstring to_wstring(unsigned long long val) { return i_to_string<wstring>(val); }
Louis Dionne89258142021-08-23 15:32:36 -0400489#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000490
Marshall Clow54e41492019-06-10 23:20:01 +0000491string to_string (float val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
492string to_string (double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
493string to_string (long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); }
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000494
Louis Dionne89258142021-08-23 15:32:36 -0400495#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
Marshall Clow54e41492019-06-10 23:20:01 +0000496wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
497wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
498wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); }
Louis Dionne89258142021-08-23 15:32:36 -0400499#endif
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000500
Howard Hinnanta5f4f8e2010-06-02 18:20:39 +0000501_LIBCPP_END_NAMESPACE_STD