11 #ifndef _LIBCPP_LFTS_STRING_VIEW
12 #define _LIBCPP_LFTS_STRING_VIEW
14 #ifndef RWrap_libcpp_string_view_h
15 #error "Do not use libcpp_string_view.h directly. #include \"RWrap_libcpp_string_view.h\" instead."
16 #endif // RWrap_libcpp_string_view_h
192 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
193 #pragma GCC system_header
196 _ROOT_LIBCPP_BEGIN_NAMESPACE_LFTS
198 template<
class _CharT,
class _Traits = _VSTD::
char_traits<_CharT> >
199 class _LIBCPP_TYPE_VIS_ONLY basic_string_view {
202 typedef _Traits traits_type;
203 typedef _CharT value_type;
204 typedef const _CharT* pointer;
205 typedef const _CharT* const_pointer;
206 typedef const _CharT& reference;
207 typedef const _CharT& const_reference;
208 typedef const_pointer const_iterator;
209 typedef const_iterator iterator;
210 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
211 typedef const_reverse_iterator reverse_iterator;
212 typedef size_t size_type;
213 typedef ptrdiff_t difference_type;
214 static _LIBCPP_CONSTEXPR
const size_type npos = -1;
217 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
218 basic_string_view() _NOEXCEPT : __data (
nullptr), __size(0) {}
220 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
221 basic_string_view(
const basic_string_view&) _NOEXCEPT = default;
223 _LIBCPP_INLINE_VISIBILITY
224 basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
226 template<class _Allocator>
227 _LIBCPP_INLINE_VISIBILITY
228 basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
229 : __data (__str.data()), __size(__str.size()) {}
231 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
232 basic_string_view(
const _CharT* __s, size_type __len)
233 : __data(__s), __size(__len)
238 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
239 basic_string_view(
const _CharT* __s)
240 : __data(__s), __size(_Traits::length(__s)) {}
243 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
244 const_iterator begin() const _NOEXCEPT {
return cbegin(); }
246 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
247 const_iterator end() const _NOEXCEPT {
return cend(); }
249 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
250 const_iterator cbegin() const _NOEXCEPT {
return __data; }
252 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
253 const_iterator cend() const _NOEXCEPT {
return __data + __size; }
255 _LIBCPP_INLINE_VISIBILITY
256 const_reverse_iterator rbegin() const _NOEXCEPT {
return const_reverse_iterator(cend()); }
258 _LIBCPP_INLINE_VISIBILITY
259 const_reverse_iterator rend() const _NOEXCEPT {
return const_reverse_iterator(cbegin()); }
261 _LIBCPP_INLINE_VISIBILITY
262 const_reverse_iterator crbegin() const _NOEXCEPT {
return const_reverse_iterator(cend()); }
264 _LIBCPP_INLINE_VISIBILITY
265 const_reverse_iterator crend() const _NOEXCEPT {
return const_reverse_iterator(cbegin()); }
268 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
269 size_type size() const _NOEXCEPT {
return __size; }
271 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
272 size_type length() const _NOEXCEPT {
return __size; }
274 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
275 size_type max_size() const _NOEXCEPT {
return (_VSTD::numeric_limits<size_type>::max)(); }
277 _LIBCPP_CONSTEXPR
bool _LIBCPP_INLINE_VISIBILITY
278 empty() const _NOEXCEPT {
return __size == 0; }
281 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
282 const_reference operator[](size_type __pos)
const {
return __data[__pos]; }
284 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
285 const_reference at(size_type __pos)
const
287 return __pos >= size()
288 ? (
throw out_of_range(
"string_view::at"), __data[0])
292 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
293 const_reference front()
const
295 return _LIBCPP_ASSERT(!empty(),
"string_view::front(): string is empty"), __data[0];
298 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
299 const_reference back()
const
301 return _LIBCPP_ASSERT(!empty(),
"string_view::back(): string is empty"), __data[__size-1];
304 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
305 const_pointer data() const _NOEXCEPT {
return __data; }
308 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
309 void clear() _NOEXCEPT
315 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
316 void remove_prefix(size_type __n) _NOEXCEPT
318 _LIBCPP_ASSERT(__n <= size(),
"remove_prefix() can't remove more than size()");
323 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
324 void remove_suffix(size_type __n) _NOEXCEPT
326 _LIBCPP_ASSERT(__n <= size(),
"remove_suffix() can't remove more than size()");
330 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
331 void swap(basic_string_view& __other) _NOEXCEPT
333 const value_type *__p = __data;
334 __data = __other.__data;
335 __other.__data = __p;
337 size_type __sz = __size;
338 __size = __other.__size;
339 __other.__size = __sz;
345 template<
class _Allocator>
346 _LIBCPP_INLINE_VISIBILITY
347 _LIBCPP_EXPLICIT
operator basic_string<_CharT, _Traits, _Allocator>()
const
348 {
return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
350 size_type copy(_CharT* __s, size_type __n, size_type __pos = 0)
const
353 throw out_of_range(
"string_view::copy");
354 size_type __rlen = (_VSTD::min)( __n, size() - __pos );
355 _VSTD::copy_n(begin() + __pos, __rlen, __s );
360 basic_string_view substr(size_type __pos = 0, size_type __n = npos)
const
366 return __pos > size()
367 ?
throw out_of_range(
"string_view::substr")
368 : basic_string_view(data() + __pos, (_VSTD::min)(__n, size() - __pos));
371 _LIBCPP_CONSTEXPR_AFTER_CXX11
int compare(basic_string_view __sv)
const _NOEXCEPT
373 size_type __rlen = (_VSTD::min)( size(), __sv.size());
374 int __retval = _Traits::compare(data(), __sv.data(), __rlen);
376 __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
380 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
381 int compare(size_type __pos1, size_type __n1, basic_string_view __sv)
const
383 return substr(__pos1, __n1).compare(__sv);
386 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
387 int compare( size_type __pos1, size_type __n1,
388 basic_string_view _sv, size_type __pos2, size_type __n2)
const
390 return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
393 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
394 int compare(
const _CharT* __s)
const
396 return compare(basic_string_view(__s));
399 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
400 int compare(size_type __pos1, size_type __n1,
const _CharT* __s)
const
402 return substr(__pos1, __n1).compare(basic_string_view(__s));
405 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
406 int compare(size_type __pos1, size_type __n1,
const _CharT* __s, size_type __n2)
const
408 return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
412 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
413 size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
415 _LIBCPP_ASSERT(__s.size() == 0 || __s.data() !=
nullptr,
"string_view::find(): recieved nullptr");
416 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
417 (data(), size(), __s.data(), __pos, __s.size());
420 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
421 size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
423 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
424 (data(), size(), __c, __pos);
427 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
428 size_type find(
const _CharT* __s, size_type __pos, size_type __n)
const
430 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find(): recieved nullptr");
431 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
432 (data(), size(), __s, __pos, __n);
435 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
436 size_type find(
const _CharT* __s, size_type __pos = 0)
const
438 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find(): recieved nullptr");
439 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
440 (data(), size(), __s, __pos, traits_type::length(__s));
444 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
445 size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
447 _LIBCPP_ASSERT(__s.size() == 0 || __s.data() !=
nullptr,
"string_view::find(): recieved nullptr");
448 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
449 (data(), size(), __s.data(), __pos, __s.size());
452 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
453 size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
455 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
456 (data(), size(), __c, __pos);
459 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
460 size_type rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
462 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::rfind(): recieved nullptr");
463 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
464 (data(), size(), __s, __pos, __n);
467 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
468 size_type rfind(
const _CharT* __s, size_type __pos=npos)
const
470 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::rfind(): recieved nullptr");
471 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
472 (data(), size(), __s, __pos, traits_type::length(__s));
476 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
477 size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
479 _LIBCPP_ASSERT(__s.size() == 0 || __s.data() !=
nullptr,
"string_view::find_first_of(): recieved nullptr");
480 return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
481 (data(), size(), __s.data(), __pos, __s.size());
484 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
485 size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
486 {
return find(__c, __pos); }
488 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
489 size_type find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
491 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_first_of(): recieved nullptr");
492 return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
493 (data(), size(), __s, __pos, __n);
496 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
497 size_type find_first_of(
const _CharT* __s, size_type __pos=0)
const
499 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_first_of(): recieved nullptr");
500 return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
501 (data(), size(), __s, __pos, traits_type::length(__s));
505 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
506 size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
508 _LIBCPP_ASSERT(__s.size() == 0 || __s.data() !=
nullptr,
"string_view::find_last_of(): recieved nullptr");
509 return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
510 (data(), size(), __s.data(), __pos, __s.size());
513 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
514 size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
515 {
return rfind(__c, __pos); }
517 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
518 size_type find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
520 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_last_of(): recieved nullptr");
521 return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
522 (data(), size(), __s, __pos, __n);
525 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
526 size_type find_last_of(
const _CharT* __s, size_type __pos=npos)
const
528 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_last_of(): recieved nullptr");
529 return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
530 (data(), size(), __s, __pos, traits_type::length(__s));
534 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
535 size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
537 _LIBCPP_ASSERT(__s.size() == 0 || __s.data() !=
nullptr,
"string_view::find_first_not_of(): recieved nullptr");
538 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
539 (data(), size(), __s.data(), __pos, __s.size());
542 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
543 size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
545 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
546 (data(), size(), __c, __pos);
549 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
550 size_type find_first_not_of(
const _CharT* __s, size_type __pos, size_type __n)
const
552 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_first_not_of(): recieved nullptr");
553 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
554 (data(), size(), __s, __pos, __n);
557 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
558 size_type find_first_not_of(
const _CharT* __s, size_type __pos=0)
const
560 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_first_not_of(): recieved nullptr");
561 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
562 (data(), size(), __s, __pos, traits_type::length(__s));
566 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
567 size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
569 _LIBCPP_ASSERT(__s.size() == 0 || __s.data() !=
nullptr,
"string_view::find_last_not_of(): recieved nullptr");
570 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
571 (data(), size(), __s.data(), __pos, __s.size());
574 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
575 size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
577 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
578 (data(), size(), __c, __pos);
581 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
582 size_type find_last_not_of(
const _CharT* __s, size_type __pos, size_type __n)
const
584 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_last_not_of(): recieved nullptr");
585 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
586 (data(), size(), __s, __pos, __n);
589 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
590 size_type find_last_not_of(
const _CharT* __s, size_type __pos=npos)
const
592 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_last_not_of(): recieved nullptr");
593 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
594 (data(), size(), __s, __pos, traits_type::length(__s));
598 const value_type* __data;
605 template<
class _CharT,
class _Traits>
606 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
607 bool operator==(basic_string_view<_CharT, _Traits> __lhs,
608 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
610 if ( __lhs.size() != __rhs.size())
return false;
611 return __lhs.compare(__rhs) == 0;
614 template<
class _CharT,
class _Traits>
615 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
616 bool operator==(basic_string_view<_CharT, _Traits> __lhs,
617 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
619 if ( __lhs.size() != __rhs.size())
return false;
620 return __lhs.compare(__rhs) == 0;
623 template<
class _CharT,
class _Traits>
624 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
625 bool operator==(
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
626 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
628 if ( __lhs.size() != __rhs.size())
return false;
629 return __lhs.compare(__rhs) == 0;
633 template<
class _CharT,
class _Traits>
634 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
635 bool operator==(basic_string_view<_CharT, _Traits> __lhs,
636 const _CharT* __rhs) _NOEXCEPT
638 basic_string_view<_CharT, _Traits> __rhsv(__rhs);
639 if ( __lhs.size() != __rhsv.size())
return false;
640 return __lhs.compare(__rhsv) == 0;
646 template<
class _CharT,
class _Traits>
647 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
648 bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
650 if ( __lhs.size() != __rhs.size())
652 return __lhs.compare(__rhs) != 0;
655 template<
class _CharT,
class _Traits>
656 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
657 bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
658 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
660 if ( __lhs.size() != __rhs.size())
662 return __lhs.compare(__rhs) != 0;
665 template<
class _CharT,
class _Traits>
666 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
667 bool operator!=(
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
668 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
670 if ( __lhs.size() != __rhs.size())
672 return __lhs.compare(__rhs) != 0;
677 template<
class _CharT,
class _Traits>
678 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
679 bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
681 return __lhs.compare(__rhs) < 0;
684 template<
class _CharT,
class _Traits>
685 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
686 bool operator<(basic_string_view<_CharT, _Traits> __lhs,
687 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
689 return __lhs.compare(__rhs) < 0;
692 template<
class _CharT,
class _Traits>
693 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
694 bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
695 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
697 return __lhs.compare(__rhs) < 0;
702 template<
class _CharT,
class _Traits>
703 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
704 bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
706 return __lhs.compare(__rhs) > 0;
709 template<
class _CharT,
class _Traits>
710 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
711 bool operator>(basic_string_view<_CharT, _Traits> __lhs,
712 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
714 return __lhs.compare(__rhs) > 0;
717 template<
class _CharT,
class _Traits>
718 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
719 bool operator>(
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
720 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
722 return __lhs.compare(__rhs) > 0;
727 template<
class _CharT,
class _Traits>
728 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
729 bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
731 return __lhs.compare(__rhs) <= 0;
734 template<
class _CharT,
class _Traits>
735 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
736 bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
737 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
739 return __lhs.compare(__rhs) <= 0;
742 template<
class _CharT,
class _Traits>
743 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
744 bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
745 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
747 return __lhs.compare(__rhs) <= 0;
752 template<
class _CharT,
class _Traits>
753 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
754 bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
756 return __lhs.compare(__rhs) >= 0;
760 template<
class _CharT,
class _Traits>
761 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
762 bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
763 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
765 return __lhs.compare(__rhs) >= 0;
768 template<
class _CharT,
class _Traits>
769 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
770 bool operator>=(
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
771 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
773 return __lhs.compare(__rhs) >= 0;
778 template<
class _CharT,
class _Traits>
779 basic_ostream<_CharT, _Traits>&
780 operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
782 return _VSTD::R__put_character_sequence(__os, __sv.data(), __sv.size());
785 typedef basic_string_view<char> string_view;
786 typedef basic_string_view<char16_t> u16string_view;
787 typedef basic_string_view<char32_t> u32string_view;
788 typedef basic_string_view<wchar_t> wstring_view;
790 _ROOT_LIBCPP_END_NAMESPACE_LFTS
791 _LIBCPP_BEGIN_NAMESPACE_STD
795 template<
class _CharT,
class _Traits>
796 struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> >
797 :
public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
799 size_t operator()(
const std::experimental::basic_string_view<_CharT, _Traits>& __val)
const _NOEXCEPT;
802 template<
class _CharT,
class _Traits>
804 hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
805 const std::experimental::basic_string_view<_CharT, _Traits>& __val)
const _NOEXCEPT
807 return __do_string_hash(__val.data(), __val.data() + __val.size());
810 #if _LIBCPP_STD_VER > 11
811 template <
class _CharT,
class _Traits>
812 __quoted_output_proxy<_CharT, const _CharT *, _Traits>
813 quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
814 _CharT __delim = _CharT(
'"'), _CharT __escape=_CharT(
'\\'))
816 return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
817 ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
821 _LIBCPP_END_NAMESPACE_STD
823 #endif // _LIBCPP_LFTS_STRING_VIEW