libstdc++
|
00001 // Components for manipulating non-owning sequences of characters -*- C++ -*- 00002 00003 // Copyright (C) 2013-2016 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file experimental/string_view 00026 * This is a TS C++ Library header. 00027 */ 00028 00029 // 00030 // N3762 basic_string_view library 00031 // 00032 00033 #ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW 00034 #define _GLIBCXX_EXPERIMENTAL_STRING_VIEW 1 00035 00036 #pragma GCC system_header 00037 00038 #if __cplusplus <= 201103L 00039 # include <bits/c++14_warning.h> 00040 #else 00041 00042 #include <string> 00043 #include <limits> 00044 #include <experimental/bits/lfts_config.h> 00045 00046 namespace std _GLIBCXX_VISIBILITY(default) 00047 { 00048 namespace experimental 00049 { 00050 inline namespace fundamentals_v1 00051 { 00052 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00053 00054 #define __cpp_lib_experimental_string_view 201411 00055 00056 /** 00057 * @class basic_string_view <experimental/string_view> 00058 * @brief A non-owning reference to a string. 00059 * 00060 * @ingroup strings 00061 * @ingroup sequences 00062 * @ingroup experimental 00063 * 00064 * @tparam _CharT Type of character 00065 * @tparam _Traits Traits for character type, defaults to 00066 * char_traits<_CharT>. 00067 * 00068 * A basic_string_view looks like this: 00069 * 00070 * @code 00071 * _CharT* _M_str 00072 * size_t _M_len 00073 * @endcode 00074 */ 00075 template<typename _CharT, typename _Traits = std::char_traits<_CharT>> 00076 class basic_string_view 00077 { 00078 public: 00079 00080 // types 00081 using traits_type = _Traits; 00082 using value_type = _CharT; 00083 using pointer = const _CharT*; 00084 using const_pointer = const _CharT*; 00085 using reference = const _CharT&; 00086 using const_reference = const _CharT&; 00087 using const_iterator = const _CharT*; 00088 using iterator = const_iterator; 00089 using const_reverse_iterator = std::reverse_iterator<const_iterator>; 00090 using reverse_iterator = const_reverse_iterator; 00091 using size_type = size_t; 00092 using difference_type = ptrdiff_t; 00093 static constexpr size_type npos = size_type(-1); 00094 00095 // [string.view.cons], construct/copy 00096 00097 constexpr 00098 basic_string_view() noexcept 00099 : _M_len{0}, _M_str{nullptr} 00100 { } 00101 00102 constexpr basic_string_view(const basic_string_view&) noexcept = default; 00103 00104 template<typename _Allocator> 00105 basic_string_view(const basic_string<_CharT, _Traits, 00106 _Allocator>& __str) noexcept 00107 : _M_len{__str.length()}, _M_str{__str.data()} 00108 { } 00109 00110 constexpr basic_string_view(const _CharT* __str) 00111 : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, 00112 _M_str{__str} 00113 { } 00114 00115 constexpr basic_string_view(const _CharT* __str, size_type __len) 00116 : _M_len{__len}, 00117 _M_str{__str} 00118 { } 00119 00120 basic_string_view& 00121 operator=(const basic_string_view&) noexcept = default; 00122 00123 // [string.view.iterators], iterators 00124 00125 constexpr const_iterator 00126 begin() const noexcept 00127 { return this->_M_str; } 00128 00129 constexpr const_iterator 00130 end() const noexcept 00131 { return this->_M_str + this->_M_len; } 00132 00133 constexpr const_iterator 00134 cbegin() const noexcept 00135 { return this->_M_str; } 00136 00137 constexpr const_iterator 00138 cend() const noexcept 00139 { return this->_M_str + this->_M_len; } 00140 00141 const_reverse_iterator 00142 rbegin() const noexcept 00143 { return const_reverse_iterator(this->end()); } 00144 00145 const_reverse_iterator 00146 rend() const noexcept 00147 { return const_reverse_iterator(this->begin()); } 00148 00149 const_reverse_iterator 00150 crbegin() const noexcept 00151 { return const_reverse_iterator(this->end()); } 00152 00153 const_reverse_iterator 00154 crend() const noexcept 00155 { return const_reverse_iterator(this->begin()); } 00156 00157 // [string.view.capacity], capacity 00158 00159 constexpr size_type 00160 size() const noexcept 00161 { return this->_M_len; } 00162 00163 constexpr size_type 00164 length() const noexcept 00165 { return _M_len; } 00166 00167 constexpr size_type 00168 max_size() const noexcept 00169 { 00170 return (npos - sizeof(size_type) - sizeof(void*)) 00171 / sizeof(value_type) / 4; 00172 } 00173 00174 constexpr bool 00175 empty() const noexcept 00176 { return this->_M_len == 0; } 00177 00178 // [string.view.access], element access 00179 00180 constexpr const _CharT& 00181 operator[](size_type __pos) const 00182 { 00183 // TODO: Assert to restore in a way compatible with the constexpr. 00184 // __glibcxx_assert(__pos < this->_M_len); 00185 return *(this->_M_str + __pos); 00186 } 00187 00188 constexpr const _CharT& 00189 at(size_type __pos) const 00190 { 00191 return __pos < this->_M_len 00192 ? *(this->_M_str + __pos) 00193 : (__throw_out_of_range_fmt(__N("basic_string_view::at: __pos " 00194 "(which is %zu) >= this->size() " 00195 "(which is %zu)"), 00196 __pos, this->size()), 00197 *this->_M_str); 00198 } 00199 00200 constexpr const _CharT& 00201 front() const 00202 { 00203 // TODO: Assert to restore in a way compatible with the constexpr. 00204 // __glibcxx_assert(this->_M_len > 0); 00205 return *this->_M_str; 00206 } 00207 00208 constexpr const _CharT& 00209 back() const 00210 { 00211 // TODO: Assert to restore in a way compatible with the constexpr. 00212 // __glibcxx_assert(this->_M_len > 0); 00213 return *(this->_M_str + this->_M_len - 1); 00214 } 00215 00216 constexpr const _CharT* 00217 data() const noexcept 00218 { return this->_M_str; } 00219 00220 // [string.view.modifiers], modifiers: 00221 00222 void 00223 remove_prefix(size_type __n) 00224 { 00225 __glibcxx_assert(this->_M_len >= __n); 00226 this->_M_str += __n; 00227 this->_M_len -= __n; 00228 } 00229 00230 void 00231 remove_suffix(size_type __n) 00232 { this->_M_len -= __n; } 00233 00234 void 00235 swap(basic_string_view& __sv) noexcept 00236 { 00237 std::swap(this->_M_len, __sv._M_len); 00238 std::swap(this->_M_str, __sv._M_str); 00239 } 00240 00241 00242 // [string.view.ops], string operations: 00243 00244 template<typename _Allocator> 00245 explicit operator basic_string<_CharT, _Traits, _Allocator>() const 00246 { 00247 return { this->_M_str, this->_M_len }; 00248 } 00249 00250 template<typename _Allocator = std::allocator<_CharT>> 00251 basic_string<_CharT, _Traits, _Allocator> 00252 to_string(const _Allocator& __alloc = _Allocator()) const 00253 { 00254 return { this->_M_str, this->_M_len, __alloc }; 00255 } 00256 00257 size_type 00258 copy(_CharT* __str, size_type __n, size_type __pos = 0) const 00259 { 00260 __glibcxx_requires_string_len(__str, __n); 00261 if (__pos > this->_M_len) 00262 __throw_out_of_range_fmt(__N("basic_string_view::copy: __pos " 00263 "(which is %zu) > this->size() " 00264 "(which is %zu)"), 00265 __pos, this->size()); 00266 size_type __rlen{std::min(__n, size_type{this->_M_len - __pos})}; 00267 for (auto __begin = this->_M_str + __pos, 00268 __end = __begin + __rlen; __begin != __end;) 00269 *__str++ = *__begin++; 00270 return __rlen; 00271 } 00272 00273 00274 // [string.view.ops], string operations: 00275 00276 constexpr basic_string_view 00277 substr(size_type __pos, size_type __n=npos) const 00278 { 00279 return __pos <= this->_M_len 00280 ? basic_string_view{this->_M_str + __pos, 00281 std::min(__n, size_type{this->_M_len - __pos})} 00282 : (__throw_out_of_range_fmt(__N("basic_string_view::substr: __pos " 00283 "(which is %zu) > this->size() " 00284 "(which is %zu)"), 00285 __pos, this->size()), basic_string_view{}); 00286 } 00287 00288 int 00289 compare(basic_string_view __str) const noexcept 00290 { 00291 int __ret = traits_type::compare(this->_M_str, __str._M_str, 00292 std::min(this->_M_len, __str._M_len)); 00293 if (__ret == 0) 00294 __ret = _S_compare(this->_M_len, __str._M_len); 00295 return __ret; 00296 } 00297 00298 int 00299 compare(size_type __pos1, size_type __n1, basic_string_view __str) const 00300 { return this->substr(__pos1, __n1).compare(__str); } 00301 00302 int 00303 compare(size_type __pos1, size_type __n1, 00304 basic_string_view __str, size_type __pos2, size_type __n2) const 00305 { return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); } 00306 00307 int 00308 compare(const _CharT* __str) const noexcept 00309 { return this->compare(basic_string_view{__str}); } 00310 00311 int 00312 compare(size_type __pos1, size_type __n1, const _CharT* __str) const 00313 { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); } 00314 00315 int 00316 compare(size_type __pos1, size_type __n1, 00317 const _CharT* __str, size_type __n2) const 00318 { 00319 return this->substr(__pos1, __n1) 00320 .compare(basic_string_view(__str, __n2)); 00321 } 00322 00323 size_type 00324 find(basic_string_view __str, size_type __pos = 0) const noexcept 00325 { return this->find(__str._M_str, __pos, __str._M_len); } 00326 00327 size_type 00328 find(_CharT __c, size_type __pos=0) const noexcept; 00329 00330 size_type 00331 find(const _CharT* __str, size_type __pos, size_type __n) const noexcept; 00332 00333 size_type 00334 find(const _CharT* __str, size_type __pos=0) const noexcept 00335 { return this->find(__str, __pos, traits_type::length(__str)); } 00336 00337 size_type 00338 rfind(basic_string_view __str, size_type __pos = npos) const noexcept 00339 { return this->rfind(__str._M_str, __pos, __str._M_len); } 00340 00341 size_type 00342 rfind(_CharT __c, size_type __pos = npos) const noexcept; 00343 00344 size_type 00345 rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept; 00346 00347 size_type 00348 rfind(const _CharT* __str, size_type __pos = npos) const noexcept 00349 { return this->rfind(__str, __pos, traits_type::length(__str)); } 00350 00351 size_type 00352 find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept 00353 { return this->find_first_of(__str._M_str, __pos, __str._M_len); } 00354 00355 size_type 00356 find_first_of(_CharT __c, size_type __pos = 0) const noexcept 00357 { return this->find(__c, __pos); } 00358 00359 size_type 00360 find_first_of(const _CharT* __str, size_type __pos, size_type __n) const; 00361 00362 size_type 00363 find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept 00364 { return this->find_first_of(__str, __pos, traits_type::length(__str)); } 00365 00366 size_type 00367 find_last_of(basic_string_view __str, 00368 size_type __pos = npos) const noexcept 00369 { return this->find_last_of(__str._M_str, __pos, __str._M_len); } 00370 00371 size_type 00372 find_last_of(_CharT __c, size_type __pos=npos) const noexcept 00373 { return this->rfind(__c, __pos); } 00374 00375 size_type 00376 find_last_of(const _CharT* __str, size_type __pos, size_type __n) const; 00377 00378 size_type 00379 find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept 00380 { return this->find_last_of(__str, __pos, traits_type::length(__str)); } 00381 00382 size_type 00383 find_first_not_of(basic_string_view __str, 00384 size_type __pos = 0) const noexcept 00385 { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); } 00386 00387 size_type 00388 find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept; 00389 00390 size_type 00391 find_first_not_of(const _CharT* __str, 00392 size_type __pos, size_type __n) const; 00393 00394 size_type 00395 find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept 00396 { 00397 return this->find_first_not_of(__str, __pos, 00398 traits_type::length(__str)); 00399 } 00400 00401 size_type 00402 find_last_not_of(basic_string_view __str, 00403 size_type __pos = npos) const noexcept 00404 { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); } 00405 00406 size_type 00407 find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept; 00408 00409 size_type 00410 find_last_not_of(const _CharT* __str, 00411 size_type __pos, size_type __n) const; 00412 00413 size_type 00414 find_last_not_of(const _CharT* __str, 00415 size_type __pos = npos) const noexcept 00416 { 00417 return this->find_last_not_of(__str, __pos, 00418 traits_type::length(__str)); 00419 } 00420 00421 private: 00422 00423 static constexpr int 00424 _S_compare(size_type __n1, size_type __n2) noexcept 00425 { 00426 return difference_type{__n1 - __n2} > std::numeric_limits<int>::max() 00427 ? std::numeric_limits<int>::max() 00428 : difference_type{__n1 - __n2} < std::numeric_limits<int>::min() 00429 ? std::numeric_limits<int>::min() 00430 : static_cast<int>(difference_type{__n1 - __n2}); 00431 } 00432 00433 size_t _M_len; 00434 const _CharT* _M_str; 00435 }; 00436 00437 00438 // [string.view.comparison], non-member basic_string_view comparison functions 00439 00440 namespace __detail 00441 { 00442 // Identity transform to make ADL work with just one argument. 00443 // See n3766.html. 00444 template<typename _Tp = void> 00445 struct __identity 00446 { typedef _Tp type; }; 00447 00448 template<> 00449 struct __identity<void>; 00450 00451 template<typename _Tp> 00452 using __idt = typename __identity<_Tp>::type; 00453 } 00454 00455 template<typename _CharT, typename _Traits> 00456 inline bool 00457 operator==(basic_string_view<_CharT, _Traits> __x, 00458 basic_string_view<_CharT, _Traits> __y) noexcept 00459 { return __x.compare(__y) == 0; } 00460 00461 template<typename _CharT, typename _Traits> 00462 inline bool 00463 operator==(basic_string_view<_CharT, _Traits> __x, 00464 __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept 00465 { return __x.compare(__y) == 0; } 00466 00467 template<typename _CharT, typename _Traits> 00468 inline bool 00469 operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x, 00470 basic_string_view<_CharT, _Traits> __y) noexcept 00471 { return __x.compare(__y) == 0; } 00472 00473 template<typename _CharT, typename _Traits> 00474 inline bool 00475 operator!=(basic_string_view<_CharT, _Traits> __x, 00476 basic_string_view<_CharT, _Traits> __y) noexcept 00477 { return !(__x == __y); } 00478 00479 template<typename _CharT, typename _Traits> 00480 inline bool 00481 operator!=(basic_string_view<_CharT, _Traits> __x, 00482 __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept 00483 { return !(__x == __y); } 00484 00485 template<typename _CharT, typename _Traits> 00486 inline bool 00487 operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x, 00488 basic_string_view<_CharT, _Traits> __y) noexcept 00489 { return !(__x == __y); } 00490 00491 template<typename _CharT, typename _Traits> 00492 inline bool 00493 operator< (basic_string_view<_CharT, _Traits> __x, 00494 basic_string_view<_CharT, _Traits> __y) noexcept 00495 { return __x.compare(__y) < 0; } 00496 00497 template<typename _CharT, typename _Traits> 00498 inline bool 00499 operator< (basic_string_view<_CharT, _Traits> __x, 00500 __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept 00501 { return __x.compare(__y) < 0; } 00502 00503 template<typename _CharT, typename _Traits> 00504 inline bool 00505 operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x, 00506 basic_string_view<_CharT, _Traits> __y) noexcept 00507 { return __x.compare(__y) < 0; } 00508 00509 template<typename _CharT, typename _Traits> 00510 inline bool 00511 operator> (basic_string_view<_CharT, _Traits> __x, 00512 basic_string_view<_CharT, _Traits> __y) noexcept 00513 { return __x.compare(__y) > 0; } 00514 00515 template<typename _CharT, typename _Traits> 00516 inline bool 00517 operator> (basic_string_view<_CharT, _Traits> __x, 00518 __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept 00519 { return __x.compare(__y) > 0; } 00520 00521 template<typename _CharT, typename _Traits> 00522 inline bool 00523 operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x, 00524 basic_string_view<_CharT, _Traits> __y) noexcept 00525 { return __x.compare(__y) > 0; } 00526 00527 template<typename _CharT, typename _Traits> 00528 inline bool 00529 operator<=(basic_string_view<_CharT, _Traits> __x, 00530 basic_string_view<_CharT, _Traits> __y) noexcept 00531 { return __x.compare(__y) <= 0; } 00532 00533 template<typename _CharT, typename _Traits> 00534 inline bool 00535 operator<=(basic_string_view<_CharT, _Traits> __x, 00536 __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept 00537 { return __x.compare(__y) <= 0; } 00538 00539 template<typename _CharT, typename _Traits> 00540 inline bool 00541 operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x, 00542 basic_string_view<_CharT, _Traits> __y) noexcept 00543 { return __x.compare(__y) <= 0; } 00544 00545 template<typename _CharT, typename _Traits> 00546 inline bool 00547 operator>=(basic_string_view<_CharT, _Traits> __x, 00548 basic_string_view<_CharT, _Traits> __y) noexcept 00549 { return __x.compare(__y) >= 0; } 00550 00551 template<typename _CharT, typename _Traits> 00552 inline bool 00553 operator>=(basic_string_view<_CharT, _Traits> __x, 00554 __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept 00555 { return __x.compare(__y) >= 0; } 00556 00557 template<typename _CharT, typename _Traits> 00558 inline bool 00559 operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x, 00560 basic_string_view<_CharT, _Traits> __y) noexcept 00561 { return __x.compare(__y) >= 0; } 00562 00563 // [string.view.io], Inserters and extractors 00564 template<typename _CharT, typename _Traits> 00565 inline basic_ostream<_CharT, _Traits>& 00566 operator<<(basic_ostream<_CharT, _Traits>& __os, 00567 basic_string_view<_CharT,_Traits> __str) 00568 { return __ostream_insert(__os, __str.data(), __str.size()); } 00569 00570 00571 // basic_string_view typedef names 00572 00573 using string_view = basic_string_view<char>; 00574 #ifdef _GLIBCXX_USE_WCHAR_T 00575 using wstring_view = basic_string_view<wchar_t>; 00576 #endif 00577 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 00578 using u16string_view = basic_string_view<char16_t>; 00579 using u32string_view = basic_string_view<char32_t>; 00580 #endif 00581 00582 _GLIBCXX_END_NAMESPACE_VERSION 00583 } // namespace fundamentals_v1 00584 } // namespace experimental 00585 00586 00587 // [string.view.hash], hash support: 00588 00589 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00590 template<typename _Tp> 00591 struct hash; 00592 00593 template<> 00594 struct hash<experimental::string_view> 00595 : public __hash_base<size_t, experimental::string_view> 00596 { 00597 size_t 00598 operator()(const experimental::string_view& __str) const noexcept 00599 { return std::_Hash_impl::hash(__str.data(), __str.length()); } 00600 }; 00601 00602 template<> 00603 struct __is_fast_hash<hash<experimental::string_view>> : std::false_type 00604 { }; 00605 00606 #ifdef _GLIBCXX_USE_WCHAR_T 00607 template<> 00608 struct hash<experimental::wstring_view> 00609 : public __hash_base<size_t, wstring> 00610 { 00611 size_t 00612 operator()(const experimental::wstring_view& __s) const noexcept 00613 { return std::_Hash_impl::hash(__s.data(), 00614 __s.length() * sizeof(wchar_t)); } 00615 }; 00616 00617 template<> 00618 struct __is_fast_hash<hash<experimental::wstring_view>> : std::false_type 00619 { }; 00620 #endif 00621 00622 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 00623 template<> 00624 struct hash<experimental::u16string_view> 00625 : public __hash_base<size_t, experimental::u16string_view> 00626 { 00627 size_t 00628 operator()(const experimental::u16string_view& __s) const noexcept 00629 { return std::_Hash_impl::hash(__s.data(), 00630 __s.length() * sizeof(char16_t)); } 00631 }; 00632 00633 template<> 00634 struct __is_fast_hash<hash<experimental::u16string_view>> : std::false_type 00635 { }; 00636 00637 template<> 00638 struct hash<experimental::u32string_view> 00639 : public __hash_base<size_t, experimental::u32string_view> 00640 { 00641 size_t 00642 operator()(const experimental::u32string_view& __s) const noexcept 00643 { return std::_Hash_impl::hash(__s.data(), 00644 __s.length() * sizeof(char32_t)); } 00645 }; 00646 00647 template<> 00648 struct __is_fast_hash<hash<experimental::u32string_view>> : std::false_type 00649 { }; 00650 #endif 00651 _GLIBCXX_END_NAMESPACE_VERSION 00652 00653 namespace experimental 00654 { 00655 // I added these EMSR. 00656 inline namespace literals 00657 { 00658 inline namespace string_view_literals 00659 { 00660 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00661 00662 inline constexpr basic_string_view<char> 00663 operator""sv(const char* __str, size_t __len) 00664 { return basic_string_view<char>{__str, __len}; } 00665 00666 #ifdef _GLIBCXX_USE_WCHAR_T 00667 inline constexpr basic_string_view<wchar_t> 00668 operator""sv(const wchar_t* __str, size_t __len) 00669 { return basic_string_view<wchar_t>{__str, __len}; } 00670 #endif 00671 00672 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 00673 inline constexpr basic_string_view<char16_t> 00674 operator""sv(const char16_t* __str, size_t __len) 00675 { return basic_string_view<char16_t>{__str, __len}; } 00676 00677 inline constexpr basic_string_view<char32_t> 00678 operator""sv(const char32_t* __str, size_t __len) 00679 { return basic_string_view<char32_t>{__str, __len}; } 00680 #endif 00681 00682 _GLIBCXX_END_NAMESPACE_VERSION 00683 } // namespace string_literals 00684 } // namespace literals 00685 } // namespace experimental 00686 } // namespace std 00687 00688 #include <experimental/bits/string_view.tcc> 00689 00690 #endif // __cplusplus <= 201103L 00691 00692 #endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW