Skip to content

Commit dc8a9a0

Browse files
committed
[libc++][NFC] Move definitions around in string.cpp to reduce _LIBCPP_HAS_NO_WIDE_CHARACTERS blocks
1 parent 96bbe1b commit dc8a9a0

File tree

1 file changed

+43
-57
lines changed

1 file changed

+43
-57
lines changed

libcxx/src/string.cpp

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -288,111 +288,97 @@ stoi(const string& str, size_t* idx, int base)
288288
return as_integer<int>( "stoi", str, idx, base );
289289
}
290290

291-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
292-
int
293-
stoi(const wstring& str, size_t* idx, int base)
294-
{
295-
return as_integer<int>( "stoi", str, idx, base );
296-
}
297-
#endif
298-
299291
long
300292
stol(const string& str, size_t* idx, int base)
301293
{
302294
return as_integer<long>( "stol", str, idx, base );
303295
}
304296

305-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
306-
long
307-
stol(const wstring& str, size_t* idx, int base)
308-
{
309-
return as_integer<long>( "stol", str, idx, base );
310-
}
311-
#endif
312-
313297
unsigned long
314298
stoul(const string& str, size_t* idx, int base)
315299
{
316300
return as_integer<unsigned long>( "stoul", str, idx, base );
317301
}
318302

319-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
320-
unsigned long
321-
stoul(const wstring& str, size_t* idx, int base)
322-
{
323-
return as_integer<unsigned long>( "stoul", str, idx, base );
324-
}
325-
#endif
326-
327303
long long
328304
stoll(const string& str, size_t* idx, int base)
329305
{
330306
return as_integer<long long>( "stoll", str, idx, base );
331307
}
332308

333-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
334-
long long
335-
stoll(const wstring& str, size_t* idx, int base)
336-
{
337-
return as_integer<long long>( "stoll", str, idx, base );
338-
}
339-
#endif
340-
341309
unsigned long long
342310
stoull(const string& str, size_t* idx, int base)
343311
{
344312
return as_integer<unsigned long long>( "stoull", str, idx, base );
345313
}
346314

347-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
348-
unsigned long long
349-
stoull(const wstring& str, size_t* idx, int base)
350-
{
351-
return as_integer<unsigned long long>( "stoull", str, idx, base );
352-
}
353-
#endif
354-
355315
float
356316
stof(const string& str, size_t* idx)
357317
{
358318
return as_float<float>( "stof", str, idx );
359319
}
360320

361-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
362-
float
363-
stof(const wstring& str, size_t* idx)
364-
{
365-
return as_float<float>( "stof", str, idx );
366-
}
367-
#endif
368-
369321
double
370322
stod(const string& str, size_t* idx)
371323
{
372324
return as_float<double>( "stod", str, idx );
373325
}
374326

375-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
376-
double
377-
stod(const wstring& str, size_t* idx)
378-
{
379-
return as_float<double>( "stod", str, idx );
380-
}
381-
#endif
382-
383327
long double
384328
stold(const string& str, size_t* idx)
385329
{
386330
return as_float<long double>( "stold", str, idx );
387331
}
388332

389333
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
334+
int
335+
stoi(const wstring& str, size_t* idx, int base)
336+
{
337+
return as_integer<int>( "stoi", str, idx, base );
338+
}
339+
340+
long
341+
stol(const wstring& str, size_t* idx, int base)
342+
{
343+
return as_integer<long>( "stol", str, idx, base );
344+
}
345+
346+
unsigned long
347+
stoul(const wstring& str, size_t* idx, int base)
348+
{
349+
return as_integer<unsigned long>( "stoul", str, idx, base );
350+
}
351+
352+
long long
353+
stoll(const wstring& str, size_t* idx, int base)
354+
{
355+
return as_integer<long long>( "stoll", str, idx, base );
356+
}
357+
358+
unsigned long long
359+
stoull(const wstring& str, size_t* idx, int base)
360+
{
361+
return as_integer<unsigned long long>( "stoull", str, idx, base );
362+
}
363+
364+
float
365+
stof(const wstring& str, size_t* idx)
366+
{
367+
return as_float<float>( "stof", str, idx );
368+
}
369+
370+
double
371+
stod(const wstring& str, size_t* idx)
372+
{
373+
return as_float<double>( "stod", str, idx );
374+
}
375+
390376
long double
391377
stold(const wstring& str, size_t* idx)
392378
{
393379
return as_float<long double>( "stold", str, idx );
394380
}
395-
#endif
381+
#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS
396382

397383
// to_string
398384

0 commit comments

Comments
 (0)