charconv 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. // Primitive numeric conversions (to_chars and from_chars) -*- C++ -*-
  2. // Copyright (C) 2017-2020 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file include/charconv
  21. * This is a Standard C++ Library header.
  22. */
  23. #ifndef _GLIBCXX_CHARCONV
  24. #define _GLIBCXX_CHARCONV 1
  25. #pragma GCC system_header
  26. // As an extension we support <charconv> in C++14, but this header should not
  27. // be included by any other library headers in C++14 mode. This ensures that
  28. // the names defined in this header are not added to namespace std unless a
  29. // user explicitly includes <charconv> in C++14 code.
  30. #if __cplusplus >= 201402L
  31. #include <type_traits>
  32. #include <bit> // for __bit_width
  33. #include <cctype> // for isdigit
  34. #include <bits/charconv.h> // for __to_chars_len, __to_chars_10_impl
  35. #include <bits/error_constants.h> // for std::errc
  36. #include <bits/int_limits.h>
  37. // FIXME: Define when floating point is supported:
  38. // #define __cpp_lib_to_chars 201611L
  39. namespace std _GLIBCXX_VISIBILITY(default)
  40. {
  41. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  42. /// Result type of std::to_chars
  43. struct to_chars_result
  44. {
  45. char* ptr;
  46. errc ec;
  47. #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L
  48. friend bool
  49. operator==(const to_chars_result&, const to_chars_result&) = default;
  50. #endif
  51. };
  52. /// Result type of std::from_chars
  53. struct from_chars_result
  54. {
  55. const char* ptr;
  56. errc ec;
  57. #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L
  58. friend bool
  59. operator==(const from_chars_result&, const from_chars_result&) = default;
  60. #endif
  61. };
  62. namespace __detail
  63. {
  64. template<typename _Tp>
  65. using __integer_to_chars_result_type
  66. = enable_if_t<__or_<__is_signed_integer<_Tp>,
  67. __is_unsigned_integer<_Tp>,
  68. is_same<char, remove_cv_t<_Tp>>>::value,
  69. to_chars_result>;
  70. // Pick an unsigned type of suitable size. This is used to reduce the
  71. // number of specializations of __to_chars_len, __to_chars etc. that
  72. // get instantiated. For example, to_chars<char> and to_chars<short>
  73. // and to_chars<unsigned> will all use the same code, and so will
  74. // to_chars<long> when sizeof(int) == sizeof(long).
  75. template<typename _Tp>
  76. struct __to_chars_unsigned_type : __make_unsigned_selector_base
  77. {
  78. using _UInts = _List<unsigned int, unsigned long, unsigned long long
  79. #if _GLIBCXX_USE_INT128
  80. , unsigned __int128
  81. #endif
  82. >;
  83. using type = typename __select<sizeof(_Tp), _UInts>::__type;
  84. };
  85. template<typename _Tp>
  86. using __unsigned_least_t = typename __to_chars_unsigned_type<_Tp>::type;
  87. // Generic implementation for arbitrary bases.
  88. // Defined in <bits/charconv.h>.
  89. template<typename _Tp>
  90. constexpr unsigned
  91. __to_chars_len(_Tp __value, int __base /* = 10 */) noexcept;
  92. template<typename _Tp>
  93. constexpr unsigned
  94. __to_chars_len_2(_Tp __value) noexcept
  95. { return std::__bit_width(__value); }
  96. // Generic implementation for arbitrary bases.
  97. template<typename _Tp>
  98. to_chars_result
  99. __to_chars(char* __first, char* __last, _Tp __val, int __base) noexcept
  100. {
  101. static_assert(is_integral<_Tp>::value, "implementation bug");
  102. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  103. to_chars_result __res;
  104. const unsigned __len = __to_chars_len(__val, __base);
  105. if (__builtin_expect((__last - __first) < __len, 0))
  106. {
  107. __res.ptr = __last;
  108. __res.ec = errc::value_too_large;
  109. return __res;
  110. }
  111. unsigned __pos = __len - 1;
  112. static constexpr char __digits[] = {
  113. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  114. 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
  115. 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
  116. 'u', 'v', 'w', 'x', 'y', 'z'
  117. };
  118. while (__val >= __base)
  119. {
  120. auto const __quo = __val / __base;
  121. auto const __rem = __val % __base;
  122. __first[__pos--] = __digits[__rem];
  123. __val = __quo;
  124. }
  125. *__first = __digits[__val];
  126. __res.ptr = __first + __len;
  127. __res.ec = {};
  128. return __res;
  129. }
  130. template<typename _Tp>
  131. __integer_to_chars_result_type<_Tp>
  132. __to_chars_16(char* __first, char* __last, _Tp __val) noexcept
  133. {
  134. static_assert(is_integral<_Tp>::value, "implementation bug");
  135. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  136. to_chars_result __res;
  137. const unsigned __len = (__to_chars_len_2(__val) + 3) / 4;
  138. if (__builtin_expect((__last - __first) < __len, 0))
  139. {
  140. __res.ptr = __last;
  141. __res.ec = errc::value_too_large;
  142. return __res;
  143. }
  144. static constexpr char __digits[] = {
  145. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  146. 'a', 'b', 'c', 'd', 'e', 'f'
  147. };
  148. unsigned __pos = __len - 1;
  149. while (__val >= 0x100)
  150. {
  151. auto __num = __val & 0xF;
  152. __val >>= 4;
  153. __first[__pos] = __digits[__num];
  154. __num = __val & 0xF;
  155. __val >>= 4;
  156. __first[__pos - 1] = __digits[__num];
  157. __pos -= 2;
  158. }
  159. if (__val >= 0x10)
  160. {
  161. const auto __num = __val & 0xF;
  162. __val >>= 4;
  163. __first[1] = __digits[__num];
  164. __first[0] = __digits[__val];
  165. }
  166. else
  167. __first[0] = __digits[__val];
  168. __res.ptr = __first + __len;
  169. __res.ec = {};
  170. return __res;
  171. }
  172. template<typename _Tp>
  173. inline __integer_to_chars_result_type<_Tp>
  174. __to_chars_10(char* __first, char* __last, _Tp __val) noexcept
  175. {
  176. static_assert(is_integral<_Tp>::value, "implementation bug");
  177. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  178. to_chars_result __res;
  179. const unsigned __len = __to_chars_len(__val, 10);
  180. if (__builtin_expect((__last - __first) < __len, 0))
  181. {
  182. __res.ptr = __last;
  183. __res.ec = errc::value_too_large;
  184. return __res;
  185. }
  186. __detail::__to_chars_10_impl(__first, __len, __val);
  187. __res.ptr = __first + __len;
  188. __res.ec = {};
  189. return __res;
  190. }
  191. template<typename _Tp>
  192. __integer_to_chars_result_type<_Tp>
  193. __to_chars_8(char* __first, char* __last, _Tp __val) noexcept
  194. {
  195. static_assert(is_integral<_Tp>::value, "implementation bug");
  196. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  197. to_chars_result __res;
  198. unsigned __len;
  199. if _GLIBCXX17_CONSTEXPR (__detail::__int_limits<_Tp>::digits <= 16)
  200. {
  201. __len = __val > 077777u ? 6u
  202. : __val > 07777u ? 5u
  203. : __val > 0777u ? 4u
  204. : __val > 077u ? 3u
  205. : __val > 07u ? 2u
  206. : 1u;
  207. }
  208. else
  209. __len = (__to_chars_len_2(__val) + 2) / 3;
  210. if (__builtin_expect((__last - __first) < __len, 0))
  211. {
  212. __res.ptr = __last;
  213. __res.ec = errc::value_too_large;
  214. return __res;
  215. }
  216. unsigned __pos = __len - 1;
  217. while (__val >= 0100)
  218. {
  219. auto __num = __val & 7;
  220. __val >>= 3;
  221. __first[__pos] = '0' + __num;
  222. __num = __val & 7;
  223. __val >>= 3;
  224. __first[__pos - 1] = '0' + __num;
  225. __pos -= 2;
  226. }
  227. if (__val >= 010)
  228. {
  229. auto const __num = __val & 7;
  230. __val >>= 3;
  231. __first[1] = '0' + __num;
  232. __first[0] = '0' + __val;
  233. }
  234. else
  235. __first[0] = '0' + __val;
  236. __res.ptr = __first + __len;
  237. __res.ec = {};
  238. return __res;
  239. }
  240. template<typename _Tp>
  241. __integer_to_chars_result_type<_Tp>
  242. __to_chars_2(char* __first, char* __last, _Tp __val) noexcept
  243. {
  244. static_assert(is_integral<_Tp>::value, "implementation bug");
  245. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  246. to_chars_result __res;
  247. const unsigned __len = __to_chars_len_2(__val);
  248. if (__builtin_expect((__last - __first) < __len, 0))
  249. {
  250. __res.ptr = __last;
  251. __res.ec = errc::value_too_large;
  252. return __res;
  253. }
  254. unsigned __pos = __len - 1;
  255. while (__pos)
  256. {
  257. __first[__pos--] = '0' + (__val & 1);
  258. __val >>= 1;
  259. }
  260. // First digit is always '1' because __to_chars_len_2 skips
  261. // leading zero bits and std::to_chars handles zero values
  262. // directly.
  263. __first[0] = '1';
  264. __res.ptr = __first + __len;
  265. __res.ec = {};
  266. return __res;
  267. }
  268. } // namespace __detail
  269. template<typename _Tp>
  270. __detail::__integer_to_chars_result_type<_Tp>
  271. __to_chars_i(char* __first, char* __last, _Tp __value, int __base = 10)
  272. {
  273. __glibcxx_assert(2 <= __base && __base <= 36);
  274. using _Up = __detail::__unsigned_least_t<_Tp>;
  275. _Up __unsigned_val = __value;
  276. if (__value == 0 && __first != __last)
  277. {
  278. *__first = '0';
  279. return { __first + 1, errc{} };
  280. }
  281. if _GLIBCXX17_CONSTEXPR (std::is_signed<_Tp>::value)
  282. if (__value < 0)
  283. {
  284. if (__builtin_expect(__first != __last, 1))
  285. *__first++ = '-';
  286. __unsigned_val = _Up(~__value) + _Up(1);
  287. }
  288. switch (__base)
  289. {
  290. case 16:
  291. return __detail::__to_chars_16(__first, __last, __unsigned_val);
  292. case 10:
  293. return __detail::__to_chars_10(__first, __last, __unsigned_val);
  294. case 8:
  295. return __detail::__to_chars_8(__first, __last, __unsigned_val);
  296. case 2:
  297. return __detail::__to_chars_2(__first, __last, __unsigned_val);
  298. default:
  299. return __detail::__to_chars(__first, __last, __unsigned_val, __base);
  300. }
  301. }
  302. #define _GLIBCXX_TO_CHARS(T) \
  303. inline to_chars_result \
  304. to_chars(char* __first, char* __last, T __value, int __base = 10) \
  305. { return std::__to_chars_i<T>(__first, __last, __value, __base); }
  306. _GLIBCXX_TO_CHARS(char)
  307. _GLIBCXX_TO_CHARS(signed char)
  308. _GLIBCXX_TO_CHARS(unsigned char)
  309. _GLIBCXX_TO_CHARS(signed short)
  310. _GLIBCXX_TO_CHARS(unsigned short)
  311. _GLIBCXX_TO_CHARS(signed int)
  312. _GLIBCXX_TO_CHARS(unsigned int)
  313. _GLIBCXX_TO_CHARS(signed long)
  314. _GLIBCXX_TO_CHARS(unsigned long)
  315. _GLIBCXX_TO_CHARS(signed long long)
  316. _GLIBCXX_TO_CHARS(unsigned long long)
  317. #if defined(__GLIBCXX_TYPE_INT_N_0)
  318. _GLIBCXX_TO_CHARS(signed __GLIBCXX_TYPE_INT_N_0)
  319. _GLIBCXX_TO_CHARS(unsigned __GLIBCXX_TYPE_INT_N_0)
  320. #endif
  321. #if defined(__GLIBCXX_TYPE_INT_N_1)
  322. _GLIBCXX_TO_CHARS(signed __GLIBCXX_TYPE_INT_N_1)
  323. _GLIBCXX_TO_CHARS(unsigned __GLIBCXX_TYPE_INT_N_1)
  324. #endif
  325. #if defined(__GLIBCXX_TYPE_INT_N_2)
  326. _GLIBCXX_TO_CHARS(signed __GLIBCXX_TYPE_INT_N_2)
  327. _GLIBCXX_TO_CHARS(unsigned __GLIBCXX_TYPE_INT_N_2)
  328. #endif
  329. #if defined(__GLIBCXX_TYPE_INT_N_3)
  330. _GLIBCXX_TO_CHARS(signed __GLIBCXX_TYPE_INT_N_3)
  331. _GLIBCXX_TO_CHARS(unsigned __GLIBCXX_TYPE_INT_N_3)
  332. #endif
  333. #undef _GLIBCXX_TO_CHARS
  334. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  335. // 3266. to_chars(bool) should be deleted
  336. to_chars_result to_chars(char*, char*, bool, int = 10) = delete;
  337. namespace __detail
  338. {
  339. template<typename _Tp>
  340. bool
  341. __raise_and_add(_Tp& __val, int __base, unsigned char __c)
  342. {
  343. if (__builtin_mul_overflow(__val, __base, &__val)
  344. || __builtin_add_overflow(__val, __c, &__val))
  345. return false;
  346. return true;
  347. }
  348. /// std::from_chars implementation for integers in base 2.
  349. template<typename _Tp>
  350. bool
  351. __from_chars_binary(const char*& __first, const char* __last, _Tp& __val)
  352. {
  353. static_assert(is_integral<_Tp>::value, "implementation bug");
  354. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  355. const ptrdiff_t __len = __last - __first;
  356. int __i = 0;
  357. while (__i < __len)
  358. {
  359. const unsigned char __c = (unsigned)__first[__i] - '0';
  360. if (__c < 2)
  361. __val = (__val << 1) | __c;
  362. else
  363. break;
  364. __i++;
  365. }
  366. __first += __i;
  367. return __i <= __detail::__int_limits<_Tp>::digits;
  368. }
  369. /// std::from_chars implementation for integers in bases 3 to 10.
  370. template<typename _Tp>
  371. bool
  372. __from_chars_digit(const char*& __first, const char* __last, _Tp& __val,
  373. int __base)
  374. {
  375. static_assert(is_integral<_Tp>::value, "implementation bug");
  376. static_assert(is_unsigned<_Tp>::value, "implementation bug");
  377. auto __matches = [__base](char __c) {
  378. return '0' <= __c && __c <= ('0' + (__base - 1));
  379. };
  380. while (__first != __last)
  381. {
  382. const char __c = *__first;
  383. if (__matches(__c))
  384. {
  385. if (!__raise_and_add(__val, __base, __c - '0'))
  386. {
  387. while (++__first != __last && __matches(*__first))
  388. ;
  389. return false;
  390. }
  391. __first++;
  392. }
  393. else
  394. return true;
  395. }
  396. return true;
  397. }
  398. constexpr unsigned char
  399. __from_chars_alpha_to_num(char __c)
  400. {
  401. switch (__c)
  402. {
  403. case 'a':
  404. case 'A':
  405. return 10;
  406. case 'b':
  407. case 'B':
  408. return 11;
  409. case 'c':
  410. case 'C':
  411. return 12;
  412. case 'd':
  413. case 'D':
  414. return 13;
  415. case 'e':
  416. case 'E':
  417. return 14;
  418. case 'f':
  419. case 'F':
  420. return 15;
  421. case 'g':
  422. case 'G':
  423. return 16;
  424. case 'h':
  425. case 'H':
  426. return 17;
  427. case 'i':
  428. case 'I':
  429. return 18;
  430. case 'j':
  431. case 'J':
  432. return 19;
  433. case 'k':
  434. case 'K':
  435. return 20;
  436. case 'l':
  437. case 'L':
  438. return 21;
  439. case 'm':
  440. case 'M':
  441. return 22;
  442. case 'n':
  443. case 'N':
  444. return 23;
  445. case 'o':
  446. case 'O':
  447. return 24;
  448. case 'p':
  449. case 'P':
  450. return 25;
  451. case 'q':
  452. case 'Q':
  453. return 26;
  454. case 'r':
  455. case 'R':
  456. return 27;
  457. case 's':
  458. case 'S':
  459. return 28;
  460. case 't':
  461. case 'T':
  462. return 29;
  463. case 'u':
  464. case 'U':
  465. return 30;
  466. case 'v':
  467. case 'V':
  468. return 31;
  469. case 'w':
  470. case 'W':
  471. return 32;
  472. case 'x':
  473. case 'X':
  474. return 33;
  475. case 'y':
  476. case 'Y':
  477. return 34;
  478. case 'z':
  479. case 'Z':
  480. return 35;
  481. }
  482. return __detail::__int_limits<unsigned char>::max();
  483. }
  484. /// std::from_chars implementation for integers in bases 11 to 26.
  485. template<typename _Tp>
  486. bool
  487. __from_chars_alnum(const char*& __first, const char* __last, _Tp& __val,
  488. int __base)
  489. {
  490. bool __valid = true;
  491. while (__first != __last)
  492. {
  493. unsigned char __c = *__first;
  494. if (std::isdigit(__c))
  495. __c -= '0';
  496. else
  497. {
  498. __c = __from_chars_alpha_to_num(__c);
  499. if (__c >= __base)
  500. break;
  501. }
  502. if (__builtin_expect(__valid, 1))
  503. __valid = __raise_and_add(__val, __base, __c);
  504. __first++;
  505. }
  506. return __valid;
  507. }
  508. template<typename _Tp>
  509. using __integer_from_chars_result_type
  510. = enable_if_t<__or_<__is_signed_integer<_Tp>,
  511. __is_unsigned_integer<_Tp>,
  512. is_same<char, remove_cv_t<_Tp>>>::value,
  513. from_chars_result>;
  514. } // namespace __detail
  515. /// std::from_chars for integral types.
  516. template<typename _Tp>
  517. __detail::__integer_from_chars_result_type<_Tp>
  518. from_chars(const char* __first, const char* __last, _Tp& __value,
  519. int __base = 10)
  520. {
  521. __glibcxx_assert(2 <= __base && __base <= 36);
  522. from_chars_result __res{__first, {}};
  523. int __sign = 1;
  524. if _GLIBCXX17_CONSTEXPR (std::is_signed<_Tp>::value)
  525. if (__first != __last && *__first == '-')
  526. {
  527. __sign = -1;
  528. ++__first;
  529. }
  530. using _Up = __detail::__unsigned_least_t<_Tp>;
  531. _Up __val = 0;
  532. const auto __start = __first;
  533. bool __valid;
  534. if (__base == 2)
  535. __valid = __detail::__from_chars_binary(__first, __last, __val);
  536. else if (__base <= 10)
  537. __valid = __detail::__from_chars_digit(__first, __last, __val, __base);
  538. else
  539. __valid = __detail::__from_chars_alnum(__first, __last, __val, __base);
  540. if (__builtin_expect(__first == __start, 0))
  541. __res.ec = errc::invalid_argument;
  542. else
  543. {
  544. __res.ptr = __first;
  545. if (!__valid)
  546. __res.ec = errc::result_out_of_range;
  547. else
  548. {
  549. if _GLIBCXX17_CONSTEXPR (std::is_signed<_Tp>::value)
  550. {
  551. _Tp __tmp;
  552. if (__builtin_mul_overflow(__val, __sign, &__tmp))
  553. __res.ec = errc::result_out_of_range;
  554. else
  555. __value = __tmp;
  556. }
  557. else
  558. {
  559. if _GLIBCXX17_CONSTEXPR (__detail::__int_limits<_Up>::max()
  560. > __detail::__int_limits<_Tp>::max())
  561. {
  562. if (__val > __detail::__int_limits<_Tp>::max())
  563. __res.ec = errc::result_out_of_range;
  564. else
  565. __value = __val;
  566. }
  567. else
  568. __value = __val;
  569. }
  570. }
  571. }
  572. return __res;
  573. }
  574. /// floating-point format for primitive numerical conversion
  575. enum class chars_format
  576. {
  577. scientific = 1, fixed = 2, hex = 4, general = fixed | scientific
  578. };
  579. constexpr chars_format
  580. operator|(chars_format __lhs, chars_format __rhs) noexcept
  581. { return (chars_format)((unsigned)__lhs | (unsigned)__rhs); }
  582. constexpr chars_format
  583. operator&(chars_format __lhs, chars_format __rhs) noexcept
  584. { return (chars_format)((unsigned)__lhs & (unsigned)__rhs); }
  585. constexpr chars_format
  586. operator^(chars_format __lhs, chars_format __rhs) noexcept
  587. { return (chars_format)((unsigned)__lhs ^ (unsigned)__rhs); }
  588. constexpr chars_format
  589. operator~(chars_format __fmt) noexcept
  590. { return (chars_format)~(unsigned)__fmt; }
  591. constexpr chars_format&
  592. operator|=(chars_format& __lhs, chars_format __rhs) noexcept
  593. { return __lhs = __lhs | __rhs; }
  594. constexpr chars_format&
  595. operator&=(chars_format& __lhs, chars_format __rhs) noexcept
  596. { return __lhs = __lhs & __rhs; }
  597. constexpr chars_format&
  598. operator^=(chars_format& __lhs, chars_format __rhs) noexcept
  599. { return __lhs = __lhs ^ __rhs; }
  600. _GLIBCXX_END_NAMESPACE_VERSION
  601. } // namespace std
  602. #endif // C++14
  603. #endif // _GLIBCXX_CHARCONV