11 #ifndef _LIBCPP_LFTS_STRING_VIEW
12 #define _LIBCPP_LFTS_STRING_VIEW
188 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
189 #pragma GCC system_header
194 template<
class _CharT,
class _Traits = _VSTD::
char_traits<_CharT> >
225 : __data (__str.data()), __size(__str.size()) {}
229 : __data(__s), __size(__len)
236 : __data(__s), __size(_Traits::
length(__s)) {}
283 return __pos >= size()
284 ? (
throw out_of_range(
"string_view::at"), __data[0])
291 return _LIBCPP_ASSERT(!empty(),
"string_view::front(): string is empty"), __data[0];
297 return _LIBCPP_ASSERT(!empty(),
"string_view::back(): string is empty"), __data[__size-1];
314 _LIBCPP_ASSERT(__n <= size(),
"remove_prefix() can't remove more than size()");
322 _LIBCPP_ASSERT(__n <= size(),
"remove_suffix() can't remove more than size()");
330 __data = __other.__data;
331 __other.__data = __p;
334 __size = __other.__size;
335 __other.__size = __sz;
341 template<
class _Allocator>
344 {
return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
346 template<
class _Allocator = allocator<_CharT> >
348 basic_string<_CharT, _Traits, _Allocator>
350 {
return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
355 throw out_of_range(
"string_view::copy");
357 _VSTD::copy_n(begin() + __pos, __rlen, __s );
368 return __pos > size()
369 ?
throw out_of_range(
"string_view::substr")
378 __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
385 return substr(__pos1, __n1).compare(__sv);
392 return substr(__pos1, __n1).compare(_sv.
substr(__pos2, __n2));
418 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
419 (data(), size(), __s.
data(), __pos, __s.
size());
425 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
426 (data(), size(), __c, __pos);
432 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find(): recieved nullptr");
433 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
434 (data(), size(), __s, __pos, __n);
440 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find(): recieved nullptr");
441 return _VSTD::__str_find<value_type, size_type, traits_type, npos>
450 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
451 (data(), size(), __s.
data(), __pos, __s.
size());
457 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
458 (data(), size(), __c, __pos);
464 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::rfind(): recieved nullptr");
465 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
466 (data(), size(), __s, __pos, __n);
472 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::rfind(): recieved nullptr");
473 return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
481 _LIBCPP_ASSERT(__s.
size() == 0 || __s.
data() !=
nullptr,
"string_view::find_first_of(): recieved nullptr");
482 return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
483 (data(), size(), __s.
data(), __pos, __s.
size());
488 {
return find(__c, __pos); }
493 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_first_of(): recieved nullptr");
494 return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
495 (data(), size(), __s, __pos, __n);
501 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_first_of(): recieved nullptr");
502 return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
510 _LIBCPP_ASSERT(__s.
size() == 0 || __s.
data() !=
nullptr,
"string_view::find_last_of(): recieved nullptr");
511 return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
512 (data(), size(), __s.
data(), __pos, __s.
size());
517 {
return rfind(__c, __pos); }
522 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_last_of(): recieved nullptr");
523 return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
524 (data(), size(), __s, __pos, __n);
530 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_last_of(): recieved nullptr");
531 return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
539 _LIBCPP_ASSERT(__s.
size() == 0 || __s.
data() !=
nullptr,
"string_view::find_first_not_of(): recieved nullptr");
540 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
541 (data(), size(), __s.
data(), __pos, __s.
size());
547 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
548 (data(), size(), __c, __pos);
554 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_first_not_of(): recieved nullptr");
555 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
556 (data(), size(), __s, __pos, __n);
562 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_first_not_of(): recieved nullptr");
563 return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
571 _LIBCPP_ASSERT(__s.
size() == 0 || __s.
data() !=
nullptr,
"string_view::find_last_not_of(): recieved nullptr");
572 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
573 (data(), size(), __s.
data(), __pos, __s.
size());
579 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
580 (data(), size(), __c, __pos);
586 _LIBCPP_ASSERT(__n == 0 || __s !=
nullptr,
"string_view::find_last_not_of(): recieved nullptr");
587 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
588 (data(), size(), __s, __pos, __n);
594 _LIBCPP_ASSERT(__s !=
nullptr,
"string_view::find_last_not_of(): recieved nullptr");
595 return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
607 template<
class _CharT,
class _Traits>
612 if ( __lhs.size() != __rhs.size())
return false;
613 return __lhs.compare(__rhs) == 0;
616 template<
class _CharT,
class _Traits>
621 if ( __lhs.size() != __rhs.size())
return false;
622 return __lhs.compare(__rhs) == 0;
625 template<
class _CharT,
class _Traits>
630 if ( __lhs.size() != __rhs.size())
return false;
631 return __lhs.compare(__rhs) == 0;
636 template<
class _CharT,
class _Traits>
640 if ( __lhs.size() != __rhs.size())
642 return __lhs.compare(__rhs) != 0;
645 template<
class _CharT,
class _Traits>
650 if ( __lhs.size() != __rhs.size())
652 return __lhs.compare(__rhs) != 0;
655 template<
class _CharT,
class _Traits>
660 if ( __lhs.size() != __rhs.size())
662 return __lhs.compare(__rhs) != 0;
667 template<
class _CharT,
class _Traits>
671 return __lhs.compare(__rhs) < 0;
674 template<
class _CharT,
class _Traits>
676 bool operator<(basic_string_view<_CharT, _Traits> __lhs,
677 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >
::type __rhs)
_NOEXCEPT
679 return __lhs.compare(__rhs) < 0;
682 template<
class _CharT,
class _Traits>
684 bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >
::type __lhs,
687 return __lhs.compare(__rhs) < 0;
692 template<
class _CharT,
class _Traits>
696 return __lhs.compare(__rhs) > 0;
699 template<
class _CharT,
class _Traits>
704 return __lhs.compare(__rhs) > 0;
707 template<
class _CharT,
class _Traits>
712 return __lhs.compare(__rhs) > 0;
717 template<
class _CharT,
class _Traits>
721 return __lhs.compare(__rhs) <= 0;
724 template<
class _CharT,
class _Traits>
726 bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
727 typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >
::type __rhs)
_NOEXCEPT
729 return __lhs.compare(__rhs) <= 0;
732 template<
class _CharT,
class _Traits>
734 bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >
::type __lhs,
737 return __lhs.compare(__rhs) <= 0;
742 template<
class _CharT,
class _Traits>
746 return __lhs.compare(__rhs) >= 0;
750 template<
class _CharT,
class _Traits>
755 return __lhs.compare(__rhs) >= 0;
758 template<
class _CharT,
class _Traits>
763 return __lhs.compare(__rhs) >= 0;
768 template<
class _CharT,
class _Traits>
769 basic_ostream<_CharT, _Traits>&
785 template<
class _CharT,
class _Traits>
787 :
public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
789 size_t operator()(
const std::experimental::basic_string_view<_CharT, _Traits>& __val)
const _NOEXCEPT;
792 template<
class _CharT,
class _Traits>
794 hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
795 const std::experimental::basic_string_view<_CharT, _Traits>& __val)
const _NOEXCEPT
797 return __do_string_hash(__val.data(), __val.data() + __val.size());
800 #if _LIBCPP_STD_VER > 11
801 template <
class _CharT,
class _Traits>
802 __quoted_output_proxy<_CharT, const _CharT *, _Traits>
803 quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
804 _CharT __delim = _CharT(
'"'), _CharT __escape=_CharT(
'\\'))
806 return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
807 ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
813 #endif // _LIBCPP_LFTS_STRING_VIEW
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const _CharT *__s, size_type __pos, size_type __n) const
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find(const _CharT *__s, size_type __pos=0) const
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
_LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY empty() const _NOEXCEPT
#define _LIBCPP_CONSTEXPR
Small helper to encapsulate whether to return the value pointed to by the iterator or its address...
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare(size_type __pos1, size_type __n1, const _CharT *__s, size_type __n2) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT
_LIBCPP_CONSTEXPR basic_string_view substr(size_type __pos=0, size_type __n=npos) const
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference front() const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void swap(basic_string_view &__other) _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_suffix(size_type __n) _NOEXCEPT
int compare(double v1, double v2, const std::string &name="", double scale=1.0)
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const _CharT *__s, size_type __pos, size_type __n) const
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#define _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_INLINE_VISIBILITY basic_string< _CharT, _Traits, _Allocator > to_string(const _Allocator &__a=_Allocator()) const
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view(const _CharT *__s)
#define _LIBCPP_TYPE_VIS_ONLY
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find(_CharT __c, size_type __pos=0) const _NOEXCEPT
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __pos) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare(size_type __pos1, size_type __n1, basic_string_view _sv, size_type __pos2, size_type __n2) const
#define _LIBCPP_ASSERT(X, Y)
const value_type * __data
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type rfind(_CharT __c, size_type __pos=npos) const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const _CharT *__s, size_type __pos, size_type __n) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator!=(basic_string_view< _CharT, _Traits > __lhs, basic_string_view< _CharT, _Traits > __rhs) _NOEXCEPT
basic_string_view< char > string_view
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
#define _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const _NOEXCEPT
Double_t length(const TVector2 &v)
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const _CharT *__s, size_type __pos=0) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator>=(basic_string_view< _CharT, _Traits > __lhs, basic_string_view< _CharT, _Traits > __rhs) _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find(const _CharT *__s, size_type __pos, size_type __n) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
const _CharT & const_reference
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type rfind(const _CharT *__s, size_type __pos=npos) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator>(basic_string_view< _CharT, _Traits > __lhs, basic_string_view< _CharT, _Traits > __rhs) _NOEXCEPT
const_reverse_iterator reverse_iterator
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT
#define _ROOT_LIBCPP_BEGIN_NAMESPACE_LFTS
_VSTD::reverse_iterator< const_iterator > const_reverse_iterator
TRObject operator()(const T1 &t1) const
const _CharT * const_pointer
const_pointer const_iterator
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type rfind(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
ptrdiff_t difference_type
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare(const _CharT *__s) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const _CharT *__s, size_type __pos, size_type __n) const
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference back() const
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_pointer data() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
#define _LIBCPP_END_NAMESPACE_STD
basic_string_view< wchar_t > wstring_view
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view() _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator==(basic_string_view< _CharT, _Traits > __lhs, basic_string_view< _CharT, _Traits > __rhs) _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type rfind(const _CharT *__s, size_type __pos, size_type __n) const
basic_ostream< _CharT, _Traits > & R__put_character_sequence(basic_ostream< _CharT, _Traits > &__os, const _CharT *__str, size_t __len)
#define _ROOT_LIBCPP_END_NAMESPACE_LFTS
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare(size_type __pos1, size_type __n1, const _CharT *__s) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
basic_string_view< char32_t > u32string_view
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view(const _CharT *__s, size_type __len)
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
basic_string_view< char16_t > u16string_view
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const _NOEXCEPT
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_prefix(size_type __n) _NOEXCEPT