1// Components for manipulating non-owning sequences of characters -*- C++ -*-
3// Copyright (C) 2013-2021 Free Software Foundation, Inc.
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
25/** @file include/string_view
26 * This is a Standard C++ Library header.
30// N3762 basic_string_view library
33#ifndef _GLIBCXX_STRING_VIEW
34#define _GLIBCXX_STRING_VIEW 1
36#pragma GCC system_header
38#if __cplusplus >= 201703L
41#include <bits/char_traits.h>
42#include <bits/functional_hash.h>
43#include <bits/range_access.h>
44#include <bits/ostream_insert.h>
45#include <ext/numeric_traits.h>
47#if __cplusplus >= 202002L
48# include <bits/ranges_base.h>
51namespace std _GLIBCXX_VISIBILITY(default)
53_GLIBCXX_BEGIN_NAMESPACE_VERSION
55# define __cpp_lib_string_view 201803L
56#if __cplusplus > 201703L
57# define __cpp_lib_constexpr_string_view 201811L
60 // Helper for basic_string and basic_string_view members.
62 __sv_check(size_t __size, size_t __pos, const char* __s)
65 __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > __size "
66 "(which is %zu)"), __s, __pos, __size);
70 // Helper for basic_string members.
71 // NB: __sv_limit doesn't check for a bad __pos value.
73 __sv_limit(size_t __size, size_t __pos, size_t __off) noexcept
75 const bool __testoff = __off < __size - __pos;
76 return __testoff ? __off : __size - __pos;
80 * @class basic_string_view <string_view>
81 * @brief A non-owning reference to a string.
86 * @tparam _CharT Type of character
87 * @tparam _Traits Traits for character type, defaults to
88 * char_traits<_CharT>.
90 * A basic_string_view looks like this:
97 template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
98 class basic_string_view
100 static_assert(!is_array_v<_CharT>);
101 static_assert(is_trivial_v<_CharT> && is_standard_layout_v<_CharT>);
102 static_assert(is_same_v<_CharT, typename _Traits::char_type>);
107 using traits_type = _Traits;
108 using value_type = _CharT;
109 using pointer = value_type*;
110 using const_pointer = const value_type*;
111 using reference = value_type&;
112 using const_reference = const value_type&;
113 using const_iterator = const value_type*;
114 using iterator = const_iterator;
115 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
116 using reverse_iterator = const_reverse_iterator;
117 using size_type = size_t;
118 using difference_type = ptrdiff_t;
119 static constexpr size_type npos = size_type(-1);
121 // [string.view.cons], construction and assignment
124 basic_string_view() noexcept
125 : _M_len{0}, _M_str{nullptr}
128 constexpr basic_string_view(const basic_string_view&) noexcept = default;
130 __attribute__((__nonnull__)) constexpr
131 basic_string_view(const _CharT* __str) noexcept
132 : _M_len{traits_type::length(__str)},
137 basic_string_view(const _CharT* __str, size_type __len) noexcept
138 : _M_len{__len}, _M_str{__str}
141#if __cplusplus >= 202002L && __cpp_lib_concepts
142 template<contiguous_iterator _It, sized_sentinel_for<_It> _End>
143 requires same_as<iter_value_t<_It>, _CharT>
144 && (!convertible_to<_End, size_type>)
146 basic_string_view(_It __first, _End __last)
147 noexcept(noexcept(__last - __first))
148 : _M_len(__last - __first), _M_str(std::to_address(__first))
151#if __cplusplus > 202002L
152 template<typename _Range, typename _DRange = remove_cvref_t<_Range>>
153 requires (!is_same_v<_DRange, basic_string_view>)
154 && ranges::contiguous_range<_Range>
155 && ranges::sized_range<_Range>
156 && is_same_v<ranges::range_value_t<_Range>, _CharT>
157 && (!is_convertible_v<_Range, const _CharT*>)
158 && (!requires (_DRange& __d) {
159 __d.operator ::std::basic_string_view<_CharT, _Traits>();
161 && (!requires { typename _DRange::traits_type; }
162 || is_same_v<typename _DRange::traits_type, _Traits>)
164 basic_string_view(_Range&& __r)
165 noexcept(noexcept(ranges::size(__r)) && noexcept(ranges::data(__r)))
166 : _M_len(ranges::size(__r)), _M_str(ranges::data(__r))
171 constexpr basic_string_view&
172 operator=(const basic_string_view&) noexcept = default;
174 // [string.view.iterators], iterator support
176 constexpr const_iterator
177 begin() const noexcept
178 { return this->_M_str; }
180 constexpr const_iterator
182 { return this->_M_str + this->_M_len; }
184 constexpr const_iterator
185 cbegin() const noexcept
186 { return this->_M_str; }
188 constexpr const_iterator
189 cend() const noexcept
190 { return this->_M_str + this->_M_len; }
192 constexpr const_reverse_iterator
193 rbegin() const noexcept
194 { return const_reverse_iterator(this->end()); }
196 constexpr const_reverse_iterator
197 rend() const noexcept
198 { return const_reverse_iterator(this->begin()); }
200 constexpr const_reverse_iterator
201 crbegin() const noexcept
202 { return const_reverse_iterator(this->end()); }
204 constexpr const_reverse_iterator
205 crend() const noexcept
206 { return const_reverse_iterator(this->begin()); }
208 // [string.view.capacity], capacity
211 size() const noexcept
212 { return this->_M_len; }
215 length() const noexcept
219 max_size() const noexcept
221 return (npos - sizeof(size_type) - sizeof(void*))
222 / sizeof(value_type) / 4;
225 [[nodiscard]] constexpr bool
226 empty() const noexcept
227 { return this->_M_len == 0; }
229 // [string.view.access], element access
231 constexpr const_reference
232 operator[](size_type __pos) const noexcept
234 __glibcxx_assert(__pos < this->_M_len);
235 return *(this->_M_str + __pos);
238 constexpr const_reference
239 at(size_type __pos) const
242 __throw_out_of_range_fmt(__N("basic_string_view::at: __pos "
243 "(which is %zu) >= this->size() "
244 "(which is %zu)"), __pos, this->size());
245 return *(this->_M_str + __pos);
248 constexpr const_reference
249 front() const noexcept
251 __glibcxx_assert(this->_M_len > 0);
252 return *this->_M_str;
255 constexpr const_reference
256 back() const noexcept
258 __glibcxx_assert(this->_M_len > 0);
259 return *(this->_M_str + this->_M_len - 1);
262 constexpr const_pointer
263 data() const noexcept
264 { return this->_M_str; }
266 // [string.view.modifiers], modifiers:
269 remove_prefix(size_type __n) noexcept
271 __glibcxx_assert(this->_M_len >= __n);
277 remove_suffix(size_type __n) noexcept
278 { this->_M_len -= __n; }
281 swap(basic_string_view& __sv) noexcept
288 // [string.view.ops], string operations:
292 copy(_CharT* __str, size_type __n, size_type __pos = 0) const
294 __glibcxx_requires_string_len(__str, __n);
295 __pos = std::__sv_check(size(), __pos, "basic_string_view::copy");
296 const size_type __rlen = std::min(__n, _M_len - __pos);
297 // _GLIBCXX_RESOLVE_LIB_DEFECTS
298 // 2777. basic_string_view::copy should use char_traits::copy
299 traits_type::copy(__str, data() + __pos, __rlen);
303 constexpr basic_string_view
304 substr(size_type __pos = 0, size_type __n = npos) const noexcept(false)
306 __pos = std::__sv_check(size(), __pos, "basic_string_view::substr");
307 const size_type __rlen = std::min(__n, _M_len - __pos);
308 return basic_string_view{_M_str + __pos, __rlen};
312 compare(basic_string_view __str) const noexcept
314 const size_type __rlen = std::min(this->_M_len, __str._M_len);
315 int __ret = traits_type::compare(this->_M_str, __str._M_str, __rlen);
317 __ret = _S_compare(this->_M_len, __str._M_len);
322 compare(size_type __pos1, size_type __n1, basic_string_view __str) const
323 { return this->substr(__pos1, __n1).compare(__str); }
326 compare(size_type __pos1, size_type __n1,
327 basic_string_view __str, size_type __pos2, size_type __n2) const
329 return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2));
332 __attribute__((__nonnull__)) constexpr int
333 compare(const _CharT* __str) const noexcept
334 { return this->compare(basic_string_view{__str}); }
336 __attribute__((__nonnull__)) constexpr int
337 compare(size_type __pos1, size_type __n1, const _CharT* __str) const
338 { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
341 compare(size_type __pos1, size_type __n1,
342 const _CharT* __str, size_type __n2) const noexcept(false)
344 return this->substr(__pos1, __n1)
345 .compare(basic_string_view(__str, __n2));
348#if __cplusplus > 201703L
349#define __cpp_lib_starts_ends_with 201711L
351 starts_with(basic_string_view __x) const noexcept
352 { return this->substr(0, __x.size()) == __x; }
355 starts_with(_CharT __x) const noexcept
356 { return !this->empty() && traits_type::eq(this->front(), __x); }
359 starts_with(const _CharT* __x) const noexcept
360 { return this->starts_with(basic_string_view(__x)); }
363 ends_with(basic_string_view __x) const noexcept
365 const auto __len = this->size();
366 const auto __xlen = __x.size();
367 return __len >= __xlen
368 && traits_type::compare(end() - __xlen, __x.data(), __xlen) == 0;
372 ends_with(_CharT __x) const noexcept
373 { return !this->empty() && traits_type::eq(this->back(), __x); }
376 ends_with(const _CharT* __x) const noexcept
377 { return this->ends_with(basic_string_view(__x)); }
380#if __cplusplus > 202002L
381#define __cpp_lib_string_contains 202011L
383 contains(basic_string_view __x) const noexcept
384 { return this->find(__x) != npos; }
387 contains(_CharT __x) const noexcept
388 { return this->find(__x) != npos; }
391 contains(const _CharT* __x) const noexcept
392 { return this->find(__x) != npos; }
395 // [string.view.find], searching
398 find(basic_string_view __str, size_type __pos = 0) const noexcept
399 { return this->find(__str._M_str, __pos, __str._M_len); }
402 find(_CharT __c, size_type __pos = 0) const noexcept;
405 find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
407 __attribute__((__nonnull__)) constexpr size_type
408 find(const _CharT* __str, size_type __pos = 0) const noexcept
409 { return this->find(__str, __pos, traits_type::length(__str)); }
412 rfind(basic_string_view __str, size_type __pos = npos) const noexcept
413 { return this->rfind(__str._M_str, __pos, __str._M_len); }
416 rfind(_CharT __c, size_type __pos = npos) const noexcept;
419 rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
421 __attribute__((__nonnull__)) constexpr size_type
422 rfind(const _CharT* __str, size_type __pos = npos) const noexcept
423 { return this->rfind(__str, __pos, traits_type::length(__str)); }
426 find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
427 { return this->find_first_of(__str._M_str, __pos, __str._M_len); }
430 find_first_of(_CharT __c, size_type __pos = 0) const noexcept
431 { return this->find(__c, __pos); }
434 find_first_of(const _CharT* __str, size_type __pos,
435 size_type __n) const noexcept;
437 __attribute__((__nonnull__)) constexpr size_type
438 find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
439 { return this->find_first_of(__str, __pos, traits_type::length(__str)); }
442 find_last_of(basic_string_view __str,
443 size_type __pos = npos) const noexcept
444 { return this->find_last_of(__str._M_str, __pos, __str._M_len); }
447 find_last_of(_CharT __c, size_type __pos=npos) const noexcept
448 { return this->rfind(__c, __pos); }
451 find_last_of(const _CharT* __str, size_type __pos,
452 size_type __n) const noexcept;
454 __attribute__((__nonnull__)) constexpr size_type
455 find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
456 { return this->find_last_of(__str, __pos, traits_type::length(__str)); }
459 find_first_not_of(basic_string_view __str,
460 size_type __pos = 0) const noexcept
461 { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
464 find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
467 find_first_not_of(const _CharT* __str,
468 size_type __pos, size_type __n) const noexcept;
470 __attribute__((__nonnull__)) constexpr size_type
471 find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
473 return this->find_first_not_of(__str, __pos,
474 traits_type::length(__str));
478 find_last_not_of(basic_string_view __str,
479 size_type __pos = npos) const noexcept
480 { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
483 find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
486 find_last_not_of(const _CharT* __str,
487 size_type __pos, size_type __n) const noexcept;
489 __attribute__((__nonnull__)) constexpr size_type
490 find_last_not_of(const _CharT* __str,
491 size_type __pos = npos) const noexcept
493 return this->find_last_not_of(__str, __pos,
494 traits_type::length(__str));
500 _S_compare(size_type __n1, size_type __n2) noexcept
502 using __limits = __gnu_cxx::__int_traits<int>;
503 const difference_type __diff = __n1 - __n2;
504 if (__diff > __limits::__max)
505 return __limits::__max;
506 if (__diff < __limits::__min)
507 return __limits::__min;
508 return static_cast<int>(__diff);
512 const _CharT* _M_str;
515#if __cplusplus > 201703L && __cpp_lib_concepts && __cpp_deduction_guides
516 template<contiguous_iterator _It, sized_sentinel_for<_It> _End>
517 basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>;
519#if __cplusplus > 202002L
520 template<ranges::contiguous_range _Range>
521 basic_string_view(_Range&&)
522 -> basic_string_view<ranges::range_value_t<_Range>>;
526 // [string.view.comparison], non-member basic_string_view comparison function
528 // Several of these functions use type_identity_t to create a non-deduced
529 // context, so that only one argument participates in template argument
530 // deduction and the other argument gets implicitly converted to the deduced
533 template<typename _CharT, typename _Traits>
535 operator==(basic_string_view<_CharT, _Traits> __x,
536 basic_string_view<_CharT, _Traits> __y) noexcept
537 { return __x.size() == __y.size() && __x.compare(__y) == 0; }
539 template<typename _CharT, typename _Traits>
541 operator==(basic_string_view<_CharT, _Traits> __x,
542 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
544 { return __x.size() == __y.size() && __x.compare(__y) == 0; }
546#if __cpp_lib_three_way_comparison
547 template<typename _CharT, typename _Traits>
549 operator<=>(basic_string_view<_CharT, _Traits> __x,
550 basic_string_view<_CharT, _Traits> __y) noexcept
551 -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
552 { return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); }
554 template<typename _CharT, typename _Traits>
556 operator<=>(basic_string_view<_CharT, _Traits> __x,
557 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
559 -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
560 { return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); }
562 template<typename _CharT, typename _Traits>
564 operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
565 basic_string_view<_CharT, _Traits> __y) noexcept
566 { return __x.size() == __y.size() && __x.compare(__y) == 0; }
568 template<typename _CharT, typename _Traits>
570 operator!=(basic_string_view<_CharT, _Traits> __x,
571 basic_string_view<_CharT, _Traits> __y) noexcept
572 { return !(__x == __y); }
574 template<typename _CharT, typename _Traits>
576 operator!=(basic_string_view<_CharT, _Traits> __x,
577 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
579 { return !(__x == __y); }
581 template<typename _CharT, typename _Traits>
583 operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
584 basic_string_view<_CharT, _Traits> __y) noexcept
585 { return !(__x == __y); }
587 template<typename _CharT, typename _Traits>
589 operator< (basic_string_view<_CharT, _Traits> __x,
590 basic_string_view<_CharT, _Traits> __y) noexcept
591 { return __x.compare(__y) < 0; }
593 template<typename _CharT, typename _Traits>
595 operator< (basic_string_view<_CharT, _Traits> __x,
596 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
598 { return __x.compare(__y) < 0; }
600 template<typename _CharT, typename _Traits>
602 operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
603 basic_string_view<_CharT, _Traits> __y) noexcept
604 { return __x.compare(__y) < 0; }
606 template<typename _CharT, typename _Traits>
608 operator> (basic_string_view<_CharT, _Traits> __x,
609 basic_string_view<_CharT, _Traits> __y) noexcept
610 { return __x.compare(__y) > 0; }
612 template<typename _CharT, typename _Traits>
614 operator> (basic_string_view<_CharT, _Traits> __x,
615 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
617 { return __x.compare(__y) > 0; }
619 template<typename _CharT, typename _Traits>
621 operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
622 basic_string_view<_CharT, _Traits> __y) noexcept
623 { return __x.compare(__y) > 0; }
625 template<typename _CharT, typename _Traits>
627 operator<=(basic_string_view<_CharT, _Traits> __x,
628 basic_string_view<_CharT, _Traits> __y) noexcept
629 { return __x.compare(__y) <= 0; }
631 template<typename _CharT, typename _Traits>
633 operator<=(basic_string_view<_CharT, _Traits> __x,
634 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
636 { return __x.compare(__y) <= 0; }
638 template<typename _CharT, typename _Traits>
640 operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
641 basic_string_view<_CharT, _Traits> __y) noexcept
642 { return __x.compare(__y) <= 0; }
644 template<typename _CharT, typename _Traits>
646 operator>=(basic_string_view<_CharT, _Traits> __x,
647 basic_string_view<_CharT, _Traits> __y) noexcept
648 { return __x.compare(__y) >= 0; }
650 template<typename _CharT, typename _Traits>
652 operator>=(basic_string_view<_CharT, _Traits> __x,
653 __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
655 { return __x.compare(__y) >= 0; }
657 template<typename _CharT, typename _Traits>
659 operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
660 basic_string_view<_CharT, _Traits> __y) noexcept
661 { return __x.compare(__y) >= 0; }
662#endif // three-way comparison
664 // [string.view.io], Inserters and extractors
665 template<typename _CharT, typename _Traits>
666 inline basic_ostream<_CharT, _Traits>&
667 operator<<(basic_ostream<_CharT, _Traits>& __os,
668 basic_string_view<_CharT,_Traits> __str)
669 { return __ostream_insert(__os, __str.data(), __str.size()); }
672 // basic_string_view typedef names
674 using string_view = basic_string_view<char>;
675#ifdef _GLIBCXX_USE_WCHAR_T
676 using wstring_view = basic_string_view<wchar_t>;
678#ifdef _GLIBCXX_USE_CHAR8_T
679 using u8string_view = basic_string_view<char8_t>;
681 using u16string_view = basic_string_view<char16_t>;
682 using u32string_view = basic_string_view<char32_t>;
684 // [string.view.hash], hash support:
686 template<typename _Tp>
690 struct hash<string_view>
691 : public __hash_base<size_t, string_view>
694 operator()(const string_view& __str) const noexcept
695 { return std::_Hash_impl::hash(__str.data(), __str.length()); }
699 struct __is_fast_hash<hash<string_view>> : std::false_type
702#ifdef _GLIBCXX_USE_WCHAR_T
704 struct hash<wstring_view>
705 : public __hash_base<size_t, wstring_view>
708 operator()(const wstring_view& __s) const noexcept
709 { return std::_Hash_impl::hash(__s.data(),
710 __s.length() * sizeof(wchar_t)); }
714 struct __is_fast_hash<hash<wstring_view>> : std::false_type
718#ifdef _GLIBCXX_USE_CHAR8_T
720 struct hash<u8string_view>
721 : public __hash_base<size_t, u8string_view>
724 operator()(const u8string_view& __str) const noexcept
725 { return std::_Hash_impl::hash(__str.data(), __str.length()); }
729 struct __is_fast_hash<hash<u8string_view>> : std::false_type
734 struct hash<u16string_view>
735 : public __hash_base<size_t, u16string_view>
738 operator()(const u16string_view& __s) const noexcept
739 { return std::_Hash_impl::hash(__s.data(),
740 __s.length() * sizeof(char16_t)); }
744 struct __is_fast_hash<hash<u16string_view>> : std::false_type
748 struct hash<u32string_view>
749 : public __hash_base<size_t, u32string_view>
752 operator()(const u32string_view& __s) const noexcept
753 { return std::_Hash_impl::hash(__s.data(),
754 __s.length() * sizeof(char32_t)); }
758 struct __is_fast_hash<hash<u32string_view>> : std::false_type
761 inline namespace literals
763 inline namespace string_view_literals
765#pragma GCC diagnostic push
766#pragma GCC diagnostic ignored "-Wliteral-suffix"
767 inline constexpr basic_string_view<char>
768 operator""sv(const char* __str, size_t __len) noexcept
769 { return basic_string_view<char>{__str, __len}; }
771#ifdef _GLIBCXX_USE_WCHAR_T
772 inline constexpr basic_string_view<wchar_t>
773 operator""sv(const wchar_t* __str, size_t __len) noexcept
774 { return basic_string_view<wchar_t>{__str, __len}; }
777#ifdef _GLIBCXX_USE_CHAR8_T
778 inline constexpr basic_string_view<char8_t>
779 operator""sv(const char8_t* __str, size_t __len) noexcept
780 { return basic_string_view<char8_t>{__str, __len}; }
783 inline constexpr basic_string_view<char16_t>
784 operator""sv(const char16_t* __str, size_t __len) noexcept
785 { return basic_string_view<char16_t>{__str, __len}; }
787 inline constexpr basic_string_view<char32_t>
788 operator""sv(const char32_t* __str, size_t __len) noexcept
789 { return basic_string_view<char32_t>{__str, __len}; }
791#pragma GCC diagnostic pop
792 } // namespace string_literals
793 } // namespace literals
795#if __cpp_lib_concepts
798 // Opt-in to borrowed_range concept
799 template<typename _CharT, typename _Traits>
800 inline constexpr bool
801 enable_borrowed_range<basic_string_view<_CharT, _Traits>> = true;
803 // Opt-in to view concept
804 template<typename _CharT, typename _Traits>
805 inline constexpr bool
806 enable_view<basic_string_view<_CharT, _Traits>> = true;
809_GLIBCXX_END_NAMESPACE_VERSION
812#include <bits/string_view.tcc>
814#endif // __cplusplus <= 201402L
816#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW