#pragma once
#ifndef _XSTRING_
#define _XSTRING_
#ifndef RC_INVOKED
#include <xmemory0>
#pragma pack(push,_CRT_PACKING)
#pragma warning(push,_STL_WARNING_LEVEL)
#pragma warning(disable: _STL_DISABLED_WARNINGS)
#pragma warning(disable:
4455
4494
4619
4643
4702
4984
4988
)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
template
<
class
>
using
=
typename
::char_type;
template
<
class
>
using
=
const
typename
::char_type *;
template
<
class
>
constexpr bool _Traits_equal(_In_reads_(_Left_size) const _Traits_ptr_t<_Traits> _Left, const size_t _Left_size,
constexpr
bool
(
const
<
>
,
const
,
_In_reads_(_Right_size) const _Traits_ptr_t<_Traits> _Right, const size_t _Right_size) noexcept
const
<
>
,
const
)
noexcept
{
return
(
&&
::compare(
,
,
) ==
0
);
}
template
<
class
>
constexpr int _Traits_compare(_In_reads_(_Left_size) const _Traits_ptr_t<_Traits> _Left, const size_t _Left_size,
constexpr
int
(
const
<
>
,
const
,
_In_reads_(_Right_size) const _Traits_ptr_t<_Traits> _Right, const size_t _Right_size) noexcept
const
<
>
,
const
)
noexcept
{
const
int
=
::compare(
,
,
(
,
));
if
(
_Ans
0
)
{
return
(
_Ans
);
}
if
(
)
{
return
(-
1
);
}
if
(
>
)
{
return
(
1
);
}
return
(
0
);
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size) noexcept
const
<
>
,
const
)
noexcept
{
if
(
>
||
>
-
)
{
return
(
static_cast
<
>(-
1
));
}
if
(
0
)
{
return
(
);
}
const
auto
=
+ (
-
) +
1
;
for
(
auto
=
+
; ; ++
_Match_try
)
{
_Match_try
=
::find(
_Match_try
,
static_cast
<
>(
_Possible_matches_end
-
_Match_try
), *
);
if
(!
_Match_try
)
{
return
(
static_cast
<
>(-
1
));
}
if
(
::compare(
_Match_try
,
,
) ==
0
)
{
return
(
static_cast
<
>(
_Match_try
-
));
}
}
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
const
<
>
)
noexcept
{
if
(
)
{
const
auto
=
::find(
+
,
-
,
);
if
(
_Found_at
)
{
return
(
static_cast
<
>(
_Found_at
-
));
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size) noexcept
const
<
>
,
const
)
noexcept
{
if
(
0
)
{
return
(
(
,
));
}
if
(
<=
)
{
for
(
auto
=
+
(
,
-
); ; --
_Match_try
)
{
if
(
::eq(*
_Match_try
, *
)
&&
::compare(
_Match_try
,
,
) ==
0
)
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
const
<
>
)
noexcept
{
if
(
0
)
{
for
(
auto
=
+
(
,
-
1
); ; --
_Match_try
)
{
if
(
::eq(*
_Match_try
,
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
,
bool
=
<
>::
>
class
{
public
:
constexpr
bool
(
const
*
,
const
*
const
)
{
for
(;
; ++
)
{
[
static_cast
<
unsigned
char
>(*
)] =
true
;
}
return
(
true
);
}
constexpr
bool
(
const
)
const
{
return
(
[
static_cast
<
unsigned
char
>(
)]);
}
private
:
bool
[
256
] = {};
};
template
<
class
>
class
<
,
false
>
{
public
:
static_assert
(
<
>,
"Standard char_traits is only provided for char, wchar_t, char16_t, and char32_t. See N5687 [char.traits]. "
"Visual C++ accepts other unsigned integral types as an extension."
);
constexpr
bool
(
const
*
,
const
*
const
)
{
for
(;
; ++
)
{
const
auto
= *
;
if
(
_Ch
>=
256U
)
{
return
(
false
);
}
[
static_cast
<
unsigned
char
>(
_Ch
)] =
true
;
}
return
(
true
);
}
constexpr
bool
(
const
)
const
{
return
(
<
256U
&&
[
]);
}
private
:
bool
[
256
] = {};
};
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
0
&&
)
{
const
auto
=
+
;
for
(
auto
=
+
;
_Match_try
<
_End
; ++
_Match_try
)
{
if
(
::find(
,
, *
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
0
&&
)
{
<
typename
::char_type>
;
if
(!
_Matches
.
(
,
+
))
{
return
(
<
>(
,
,
,
,
,
{}));
}
const
auto
=
+
;
for
(
auto
=
+
;
_Match_try
<
_End
; ++
_Match_try
)
{
if
(
_Matches
.
(*
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
0
&&
0
)
{
for
(
auto
=
+
(
,
-
1
); ; --
_Match_try
)
{
if
(
::find(
,
, *
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
0
&&
0
)
{
<
typename
::char_type>
;
if
(!
_Matches
.
(
,
+
))
{
return
(
<
>(
,
,
,
,
,
{}));
}
for
(
auto
=
+
(
,
-
1
); ; --
_Match_try
)
{
if
(
_Matches
.
(*
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
_Traits_find_first_not_of
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
)
{
const
auto
=
+
;
for
(
auto
=
+
;
_Match_try
<
_End
; ++
_Match_try
)
{
if
(!
::find(
,
, *
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
_Traits_find_first_not_of
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
)
{
<
typename
::char_type>
;
if
(!
_Matches
.
(
,
+
))
{
return
(
_Traits_find_first_not_of
<
>(
,
,
,
,
,
{}));
}
const
auto
=
+
;
for
(
auto
=
+
;
_Match_try
<
_End
; ++
_Match_try
)
{
if
(!
_Matches
.
(*
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
const
<
>
)
noexcept
{
if
(
)
{
const
auto
=
+
;
for
(
auto
=
+
;
_Match_try
<
_End
; ++
_Match_try
)
{
if
(!
::eq(*
_Match_try
,
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
0
)
{
for
(
auto
=
+
(
,
-
1
); ; --
_Match_try
)
{
if
(!
::find(
,
, *
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
_In_reads_(_Needle_size) const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept
const
<
>
,
const
,
)
noexcept
{
if
(
0
)
{
<
typename
::char_type>
;
if
(!
_Matches
.
(
,
+
))
{
return
(
<
>(
,
,
,
,
,
{}));
}
for
(
auto
=
+
(
,
-
1
); ; --
_Match_try
)
{
if
(!
_Matches
.
(*
_Match_try
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
template
<
class
>
constexpr
(
_In_reads_(_Hay_size) const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at,
const
<
>
,
const
,
const
,
const
<
>
)
noexcept
{
if
(
0
)
{
for
(
auto
=
+
(
,
-
1
); ; --
_Match_try
)
{
if
(!
::eq(*
_Match_try
,
))
{
return
(
static_cast
<
>(
_Match_try
-
));
}
if
(
_Match_try
==
)
{
break
;
}
}
}
return
(
static_cast
<
>(-
1
));
}
#if _HAS_CXX17
// CLASS TEMPLATE _String_view_iterator
template<class _Elem,
class _Traits = char_traits<_Elem>>
class basic_string_view;
template<class _Traits>
class _String_view_iterator
{ // iterator for character buffer wrapper
public:
using iterator_category = random_access_iterator_tag;
using value_type = typename _Traits::char_type;
using difference_type = ptrdiff_t;
using pointer = const value_type *;
using reference = const value_type&;
constexpr _String_view_iterator() noexcept
#if _ITERATOR_DEBUG_LEVEL >= 1
: _Mydata(),
_Mysize(0),
_Myoff(0)
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
: _Myptr()
#endif /* _ITERATOR_DEBUG_LEVEL */
{ // default-initialize a basic_string_view::const_iterator
}
private:
friend basic_string_view<value_type, _Traits>;
#if _ITERATOR_DEBUG_LEVEL >= 1
constexpr _String_view_iterator(const pointer _Data, const size_t _Size, const size_t _Off) noexcept
: _Mydata(_Data),
_Mysize(_Size),
_Myoff(_Off)
{ // initialize a basic_string_view::const_iterator
}
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
constexpr explicit _String_view_iterator(const pointer _Ptr) noexcept
: _Myptr(_Ptr)
{ // initialize a basic_string_view::const_iterator
}
#endif /* _ITERATOR_DEBUG_LEVEL */
public:
_NODISCARD constexpr reference operator*() const noexcept
{ // return designated object
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata, "cannot dereference value-initialized string_view iterator");
_STL_VERIFY(_Myoff < _Mysize, "cannot dereference end string_view iterator");
return (_Mydata[_Myoff]);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (*_Myptr);
#endif /* _ITERATOR_DEBUG_LEVEL */
}
_NODISCARD constexpr pointer operator->() const noexcept
{ // return pointer to class object
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata, "cannot dereference value-initialized string_view iterator");
_STL_VERIFY(_Myoff < _Mysize, "cannot dereference end string_view iterator");
return (_Mydata + _Myoff);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (_Myptr);
#endif /* _ITERATOR_DEBUG_LEVEL */
}
constexpr _String_view_iterator& operator++() noexcept
{ // preincrement
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata, "cannot increment value-initialized string_view iterator");
_STL_VERIFY(_Myoff < _Mysize, "cannot increment string_view iterator past end");
++_Myoff;
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
++_Myptr;
#endif /* _ITERATOR_DEBUG_LEVEL */
return (*this);
}
constexpr _String_view_iterator operator++(int) noexcept
{ // postincrement
_String_view_iterator _Tmp{*this};
++*this;
return (_Tmp);
}
constexpr _String_view_iterator& operator--() noexcept
{ // predecrement
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata, "cannot decrement value-initialized string_view iterator");
_STL_VERIFY(_Myoff != 0, "cannot decrement string_view iterator before begin");
--_Myoff;
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
--_Myptr;
#endif /* _ITERATOR_DEBUG_LEVEL */
return (*this);
}
constexpr _String_view_iterator operator--(int) noexcept
{ // postdecrement
_String_view_iterator _Tmp{*this};
--*this;
return (_Tmp);
}
constexpr void _Verify_offset(const difference_type _Off) const noexcept
{
#if _ITERATOR_DEBUG_LEVEL >= 1
if (_Off != 0)
{
_STL_VERIFY(_Mydata, "cannot seek value-initialized string_view iterator");
}
if (_Off < 0)
{
#pragma warning(suppress: 4146) // unary minus operator applied to unsigned type, result still unsigned
_STL_VERIFY(_Myoff >= -static_cast<size_t>(_Off),
"cannot seek string_view iterator before begin");
}
if (_Off > 0)
{
_STL_VERIFY(_Mysize - _Myoff >= static_cast<size_t>(_Off),
"cannot seek string_view iterator after end");
}
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
(void)_Off;
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
}
constexpr _String_view_iterator& operator+=(const difference_type _Off) noexcept
{ // increment by integer
#if _ITERATOR_DEBUG_LEVEL >= 1
_Verify_offset(_Off);
_Myoff += _Off;
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
_Myptr += _Off;
#endif /* _ITERATOR_DEBUG_LEVEL */
return (*this);
}
_NODISCARD constexpr _String_view_iterator operator+(const difference_type _Off) const noexcept
{ // return this + integer
_String_view_iterator _Tmp{*this};
_Tmp += _Off;
return (_Tmp);
}
constexpr _String_view_iterator& operator-=(const difference_type _Off) noexcept
{ // decrement by integer
#if _ITERATOR_DEBUG_LEVEL >= 1
if (_Off != 0)
{
_STL_VERIFY(_Mydata, "cannot seek value-initialized string_view iterator");
}
if (_Off > 0)
{
_STL_VERIFY(_Myoff >= static_cast<size_t>(_Off),
"cannot seek string_view iterator before begin");
}
if (_Off < 0)
{
#pragma warning(suppress: 4146) // unary minus operator applied to unsigned type, result still unsigned
_STL_VERIFY(_Mysize - _Myoff >= -static_cast<size_t>(_Off),
"cannot seek string_view iterator after end");
}
_Myoff -= _Off;
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
_Myptr -= _Off;
#endif /* _ITERATOR_DEBUG_LEVEL */
return (*this);
}
_NODISCARD constexpr _String_view_iterator operator-(const difference_type _Off) const noexcept
{ // return this - integer
_String_view_iterator _Tmp{*this};
_Tmp -= _Off;
return (_Tmp);
}
_NODISCARD constexpr difference_type operator-(const _String_view_iterator& _Right) const noexcept
{ // return difference of iterators
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata == _Right._Mydata && _Mysize == _Right._Mysize,
"cannot subtract incompatible string_view iterators");
return (static_cast<difference_type>(_Myoff - _Right._Myoff));
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (_Myptr - _Right._Myptr);
#endif /* _ITERATOR_DEBUG_LEVEL */
}
_NODISCARD constexpr reference operator[](const difference_type _Off) const noexcept
{ // subscript
return (*(*this + _Off));
}
_NODISCARD constexpr bool operator==(const _String_view_iterator& _Right) const noexcept
{ // test for iterator equality
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata == _Right._Mydata && _Mysize == _Right._Mysize,
"cannot compare incompatible string_view iterators for equality");
return (_Myoff == _Right._Myoff);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (_Myptr == _Right._Myptr);
#endif /* _ITERATOR_DEBUG_LEVEL */
}
_NODISCARD constexpr bool operator!=(const _String_view_iterator& _Right) const noexcept
{ // test for iterator inequality
return (!(*this == _Right));
}
_NODISCARD constexpr bool operator<(const _String_view_iterator& _Right) const noexcept
{ // test if this < _Right
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mydata == _Right._Mydata && _Mysize == _Right._Mysize,
"cannot compare incompatible string_view iterators");
return (_Myoff < _Right._Myoff);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (_Myptr < _Right._Myptr);
#endif /* _ITERATOR_DEBUG_LEVEL */
}
_NODISCARD constexpr bool operator>(const _String_view_iterator& _Right) const noexcept
{ // test if this > _Right
return (_Right < *this);
}
_NODISCARD constexpr bool operator<=(const _String_view_iterator& _Right) const noexcept
{ // test if this <= _Right
return (!(_Right < *this));
}
_NODISCARD constexpr bool operator>=(const _String_view_iterator& _Right) const noexcept
{ // test if this >= _Right
return (!(*this < _Right));
}
#if _ITERATOR_DEBUG_LEVEL >= 1
friend constexpr void _Verify_range(const _String_view_iterator& _First, const _String_view_iterator& _Last)
{
_STL_VERIFY(_First._Mydata == _Last._Mydata && _First._Mysize == _Last._Mysize,
"string_view iterators in range are from different views");
_STL_VERIFY(_First._Myoff <= _Last._Myoff, "string_view iterator range transposed");
}
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
_NODISCARD constexpr pointer _Unwrapped() const noexcept
{
#if _ITERATOR_DEBUG_LEVEL >= 1
return (_Mydata + _Myoff);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (_Myptr);
#endif /* _ITERATOR_DEBUG_LEVEL */
}
static constexpr bool _Unwrap_when_unverified = _ITERATOR_DEBUG_LEVEL == 0;
constexpr void _Seek_to(pointer _It) noexcept
{
#if _ITERATOR_DEBUG_LEVEL >= 1
_Myoff = static_cast<size_t>(_It - _Mydata);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
_Myptr = _It;
#endif /* _ITERATOR_DEBUG_LEVEL */
}
private:
#if _ITERATOR_DEBUG_LEVEL >= 1
pointer _Mydata;
size_t _Mysize;
size_t _Myoff;
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
pointer _Myptr;
#endif /* _ITERATOR_DEBUG_LEVEL */
};
template<class _Traits>
_NODISCARD constexpr _String_view_iterator<_Traits> operator+(
const typename _String_view_iterator<_Traits>::difference_type _Off,
_String_view_iterator<_Traits> _Right) noexcept
{ // return integer + _Right
_Right += _Off;
return (_Right);
}
// CLASS TEMPLATE basic_string_view
template<class _Elem,
class _Traits>
class basic_string_view
{ // wrapper for any kind of contiguous character buffer
public:
static_assert(is_same_v<_Elem, typename _Traits::char_type>, "Bad char_traits for basic_string_view; "
"N4659 24.4.2 [string.view.template]/1 \"the type traits::char_type shall name the same type as charT.\"");
using traits_type = _Traits;
using value_type = _Elem;
using pointer = _Elem *;
using const_pointer = const _Elem *;
using reference = _Elem&;
using const_reference = const _Elem&;
using const_iterator = _String_view_iterator<_Traits>;
using iterator = const_iterator;
using const_reverse_iterator = _STD reverse_iterator<const_iterator>;
using reverse_iterator = const_reverse_iterator;
using size_type = size_t;
using difference_type = ptrdiff_t;
static constexpr auto npos{static_cast<size_type>(-1)};
constexpr basic_string_view() noexcept
: _Mydata(),
_Mysize(0)
{ // construct empty basic_string_view
}
constexpr basic_string_view(const basic_string_view&) noexcept = default;
constexpr basic_string_view& operator=(const basic_string_view&) noexcept = default;
/* implicit */ constexpr basic_string_view(_In_z_ const const_pointer _Ntcts) noexcept // strengthened
: _Mydata(_Ntcts),
_Mysize(_Traits::length(_Ntcts))
{ // construct basic_string_view around a null-terminated character-type sequence
}
constexpr basic_string_view(_In_reads_(_Count) const const_pointer _Cts, const size_type _Count)
noexcept // strengthened
: _Mydata(_Cts),
_Mysize(_Count)
{ // construct basic_string_view around a character-type sequence with explicit size
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Count == 0 || _Cts, "non-zero size null string_view");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
}
_NODISCARD constexpr const_iterator begin() const noexcept
{ // get the beginning of the range
#if _ITERATOR_DEBUG_LEVEL >= 1
return (const_iterator(_Mydata, _Mysize, 0));
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (const_iterator(_Mydata));
#endif /* _ITERATOR_DEBUG_LEVEL */
}
_NODISCARD constexpr const_iterator end() const noexcept
{ // get the end of the range
#if _ITERATOR_DEBUG_LEVEL >= 1
return (const_iterator(_Mydata, _Mysize, _Mysize));
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
return (const_iterator(_Mydata + _Mysize));
#endif /* _ITERATOR_DEBUG_LEVEL */
}
_NODISCARD constexpr const_iterator cbegin() const noexcept
{ // get the beginning of the range
return (begin());
}
_NODISCARD constexpr const_iterator cend() const noexcept
{ // get the end of the range
return (end());
}
_NODISCARD constexpr const_reverse_iterator rbegin() const noexcept
{ // get the beginning of the reversed range
return (const_reverse_iterator{end()});
}
_NODISCARD constexpr const_reverse_iterator rend() const noexcept
{ // get the end of the reversed range
return (const_reverse_iterator{begin()});
}
_NODISCARD constexpr const_reverse_iterator crbegin() const noexcept
{ // get the beginning of the reversed range
return (rbegin());
}
_NODISCARD constexpr const_reverse_iterator crend() const noexcept
{ // get the end of the reversed range
return (rend());
}
constexpr const_pointer _Unchecked_begin() const noexcept
{ // get pointer to beginning of the range
return (_Mydata);
}
constexpr const_pointer _Unchecked_end() const noexcept
{ // get pointer to end of the range
return (_Mydata + _Mysize);
}
_NODISCARD constexpr size_type size() const noexcept
{ // get the size of this basic_string_view
return (_Mysize);
}
_NODISCARD constexpr size_type length() const noexcept
{ // get the size of this basic_string_view
return (_Mysize);
}
_NODISCARD constexpr bool empty() const noexcept
{ // check whether this basic_string_view is empty
return (_Mysize == 0);
}
_NODISCARD constexpr const_pointer data() const noexcept
{ // get the base pointer of this basic_string_view
return (_Mydata);
}
_NODISCARD constexpr size_type max_size() const noexcept
{ // get the maximum possible size
// bound to PTRDIFF_MAX to make end() - begin() well defined (also makes room for npos)
// bound to static_cast<size_t>(-1) / sizeof(_Elem) by address space limits
return (_Min_value(static_cast<size_t>(PTRDIFF_MAX), static_cast<size_t>(-1) / sizeof(_Elem)));
}
_NODISCARD constexpr const_reference operator[](const size_type _Off) const noexcept // strengthened
{ // get character at offset; assume offset is in range
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Off < _Mysize, "string_view subscript out of range");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
return (_Mydata[_Off]);
}
_NODISCARD constexpr const_reference at(const size_type _Off) const
{ // get the character at _Off or throw if that is out of range
_Check_offset_exclusive(_Off);
return (_Mydata[_Off]);
}
_NODISCARD constexpr const_reference front() const noexcept // strengthened
{ // returns a reference to the first character in *this
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mysize != 0, "cannot call front on empty string_view");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
return (_Mydata[0]);
}
_NODISCARD constexpr const_reference back() const noexcept // strengthened
{ // returns a reference to the last character in *this
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mysize != 0, "cannot call back on empty string_view");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
return (_Mydata[_Mysize - 1]);
}
constexpr void remove_prefix(const size_type _Count) noexcept // strengthened
{ // chop off the beginning
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mysize >= _Count, "cannot remove prefix longer than total size");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
_Mydata += _Count;
_Mysize -= _Count;
}
constexpr void remove_suffix(const size_type _Count) noexcept // strengthened
{ // chop off the end
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Mysize >= _Count, "cannot remove suffix longer than total size");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
_Mysize -= _Count;
}
constexpr void swap(basic_string_view& _Other) noexcept
{ // swap contents
const basic_string_view _Tmp{_Other}; // note: std::swap is not constexpr
_Other = *this;
*this = _Tmp;
}
constexpr size_type copy(_Out_writes_(_Count) _Elem * const _Ptr, size_type _Count,
const size_type _Off = 0) const
{ // copy [_Off, _Off + Count) to [_Ptr, _Ptr + _Count)
_Check_offset(_Off);
_Count = _Clamp_suffix_size(_Off, _Count);
_Traits::copy(_Ptr, _Mydata + _Off, _Count);
return (_Count);
}
_Pre_satisfies_(_Dest_size >= _Count) constexpr size_type _Copy_s(
_Out_writes_all_(_Dest_size) _Elem * const _Dest, const size_type _Dest_size,
size_type _Count, const size_type _Off = 0) const
{ // copy [_Off, _Off + _Count) to [_Dest, _Dest + _Count)
_Check_offset(_Off);
_Count = _Clamp_suffix_size(_Off, _Count);
_Traits::_Copy_s(_Dest, _Dest_size, _Mydata + _Off, _Count);
return (_Count);
}
_NODISCARD constexpr basic_string_view substr(const size_type _Off = 0, size_type _Count = npos) const
{ // return a new basic_string_view moved forward by _Off and trimmed to _Count elements
_Check_offset(_Off);
_Count = _Clamp_suffix_size(_Off, _Count);
return (basic_string_view(_Mydata + _Off, _Count));
}
constexpr bool _Equal(const basic_string_view _Right) const noexcept
{ // test if *this and _Right are equal
return (_Traits_equal<_Traits>(_Mydata, _Mysize, _Right._Mydata, _Right._Mysize));
}
_NODISCARD constexpr int compare(const basic_string_view _Right) const noexcept
{ // compare [0, _Mysize) with _Right
return (_Traits_compare<_Traits>(_Mydata, _Mysize, _Right._Mydata, _Right._Mysize));
}
_NODISCARD constexpr int compare(const size_type _Off, const size_type _N0, const basic_string_view _Right) const
{ // compare [_Off, _Off + _N0) with _Right
return (substr(_Off, _N0).compare(_Right));
}
_NODISCARD constexpr int compare(const size_type _Off, const size_type _N0,
const basic_string_view _Right, const size_type _Roff, const size_type _Count) const
{ // compare [_Off, _Off + _N0) with _Right [_Roff, _Roff + _Count)
return (substr(_Off, _N0).compare(_Right.substr(_Roff, _Count)));
}
_NODISCARD constexpr int compare(_In_z_ const _Elem * const _Ptr) const
{ // compare [0, _Mysize) with [_Ptr, <null>)
return (compare(basic_string_view(_Ptr)));
}
_NODISCARD constexpr int compare(const size_type _Off, const size_type _N0,
_In_z_ const _Elem * const _Ptr) const
{ // compare [_Off, _Off + _N0) with [_Ptr, <null>)
return (substr(_Off, _N0).compare(basic_string_view(_Ptr)));
}
_NODISCARD constexpr int compare(const size_type _Off, const size_type _N0,
_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Count) const
{ // compare [_Off, _Off + _N0) with [_Ptr, _Ptr + _Count)
return (substr(_Off, _N0).compare(basic_string_view(_Ptr, _Count)));
}
_NODISCARD constexpr size_type find(const basic_string_view _Right, const size_type _Off = 0) const noexcept
{ // look for _Right beginning at or after _Off
return (_Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize));
}
_NODISCARD constexpr size_type find(const _Elem _Ch, const size_type _Off = 0) const noexcept
{ // look for _Ch at or after _Off
return (_Traits_find_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch));
}
_NODISCARD constexpr size_type find(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
const size_type _Count) const noexcept // strengthened
{ // look for [_Ptr, _Ptr + _Count) beginning at or after _Off
return (_Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count));
}
_NODISCARD constexpr size_type find(_In_z_ const _Elem * const _Ptr, const size_type _Off = 0) const
noexcept // strengthened
{ // look for [_Ptr, <null>) beginning at or after _Off
return (_Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr)));
}
_NODISCARD constexpr size_type rfind(const basic_string_view _Right, const size_type _Off = npos) const noexcept
{ // look for _Right beginning before _Off
return (_Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize));
}
_NODISCARD constexpr size_type rfind(const _Elem _Ch, const size_type _Off = npos) const noexcept
{ // look for _Ch before _Off
return (_Traits_rfind_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch));
}
_NODISCARD constexpr size_type rfind(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
const size_type _Count) const noexcept // strengthened
{ // look for [_Ptr, _Ptr + _Count) beginning before _Off
return (_Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count));
}
_NODISCARD constexpr size_type rfind(_In_z_ const _Elem * const _Ptr, const size_type _Off = npos) const
noexcept // strengthened
{ // look for [_Ptr, <null>) beginning before _Off
return (_Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr)));
}
_NODISCARD constexpr size_type find_first_of(const basic_string_view _Right,
const size_type _Off = 0) const noexcept
{ // look for one of _Right at or after _Off
return (_Traits_find_first_of<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_first_of(const _Elem _Ch, const size_type _Off = 0) const noexcept
{ // look for _Ch at or after _Off
return (_Traits_find_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch));
}
_NODISCARD constexpr size_type find_first_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
const size_type _Count) const noexcept // strengthened
{ // look for one of [_Ptr, _Ptr + _Count) at or after _Off
return (_Traits_find_first_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_first_of(_In_z_ const _Elem * const _Ptr,
const size_type _Off = 0) const noexcept // strengthened
{ // look for one of [_Ptr, <null>) at or after _Off
return (_Traits_find_first_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr),
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_last_of(const basic_string_view _Right, const size_type _Off = npos)
const noexcept
{ // look for one of _Right before _Off
return (_Traits_find_last_of<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_last_of(const _Elem _Ch, const size_type _Off = npos) const noexcept
{ // look for _Ch before _Off
return (_Traits_rfind_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch));
}
_NODISCARD constexpr size_type find_last_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
const size_type _Count) const noexcept // strengthened
{ // look for one of [_Ptr, _Ptr + _Count) before _Off
return (_Traits_find_last_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_last_of(_In_z_ const _Elem * const _Ptr, const size_type _Off = npos) const
noexcept // strengthened
{ // look for one of [_Ptr, <null>) before _Off
return (_Traits_find_last_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr),
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_first_not_of(const basic_string_view _Right,
const size_type _Off = 0) const noexcept
{ // look for none of _Right at or after _Off
return (_Traits_find_first_not_of<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const noexcept
{ // look for any value other than _Ch at or after _Off
return (_Traits_find_not_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch));
}
_NODISCARD constexpr size_type find_first_not_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
const size_type _Count) const noexcept // strengthened
{ // look for none of [_Ptr, _Ptr + _Count) at or after _Off
return (_Traits_find_first_not_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_first_not_of(_In_z_ const _Elem * const _Ptr, const size_type _Off = 0) const
noexcept // strengthened
{ // look for none of [_Ptr, <null>) at or after _Off
return (_Traits_find_first_not_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr),
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_last_not_of(const basic_string_view _Right,
const size_type _Off = npos) const noexcept
{ // look for none of _Right before _Off
return (_Traits_find_last_not_of<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const noexcept
{ // look for any value other than _Ch before _Off
return (_Traits_rfind_not_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch));
}
_NODISCARD constexpr size_type find_last_not_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
const size_type _Count) const noexcept // strengthened
{ // look for none of [_Ptr, _Ptr + _Count) before _Off
return (_Traits_find_last_not_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count,
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr size_type find_last_not_of(_In_z_ const _Elem * const _Ptr, const size_type _Off = npos) const
noexcept // strengthened
{ // look for none of [_Ptr, <null>) before _Off
return (_Traits_find_last_not_of<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr),
_Is_specialization<_Traits, char_traits>{}));
}
_NODISCARD constexpr bool _Starts_with(const basic_string_view _View) const noexcept
{ // test if this instance begins with _View
return (_Mysize >= _View._Mysize && _Traits::compare(_Mydata, _View._Mydata, _View._Mysize) == 0);
}
private:
constexpr void _Check_offset(const size_type _Off) const
{ // checks whether _Off is in the bounds of [0, size()]
if (_Mysize < _Off)
{
_Xran();
}
}
constexpr void _Check_offset_exclusive(const size_type _Off) const
{ // checks whether _Off is in the bounds of [0, size())
if (_Mysize <= _Off)
{
_Xran();
}
}
constexpr size_type _Clamp_suffix_size(const size_type _Off, const size_type _Size) const noexcept
{ // trims _Size to the longest it can be assuming a string at/after _Off
return (_Min_value(_Size, _Mysize - _Off));
}
[[noreturn]] static void _Xran()
{ // report an out_of_range error
_Xout_of_range("invalid string_view position");
}
const_pointer _Mydata;
size_type _Mysize;
};
// FUNCTION TEMPLATES operator== FOR basic_string_view
template<class _Elem,
class _Traits>
_NODISCARD constexpr bool operator==(const basic_string_view<_Elem, _Traits> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // compare basic_string_view instances for equality
return (_Lhs._Equal(_Rhs));
}
template<class _Elem,
class _Traits,
int = 1> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator==(const _Identity_t<basic_string_view<_Elem, _Traits>> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // compare objects convertible to basic_string_view instances for equality
return (_Lhs._Equal(_Rhs));
}
template<class _Elem,
class _Traits,
int = 2> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator==(const basic_string_view<_Elem, _Traits> _Lhs,
const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept
{ // compare objects convertible to basic_string_view instances for equality
return (_Lhs._Equal(_Rhs));
}
// FUNCTION TEMPLATES operator!= FOR basic_string_view
template<class _Elem,
class _Traits>
_NODISCARD constexpr bool operator!=(const basic_string_view<_Elem, _Traits> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // compare basic_string_view instances for inequality
return (!_Lhs._Equal(_Rhs));
}
template<class _Elem,
class _Traits,
int = 1> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator!=(const _Identity_t<basic_string_view<_Elem, _Traits>> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // compare objects convertible to basic_string_view instances for inequality
return (!_Lhs._Equal(_Rhs));
}
template<class _Elem,
class _Traits,
int = 2> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator!=(const basic_string_view<_Elem, _Traits> _Lhs,
const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept
{ // compare objects convertible to basic_string_view instances for inequality
return (!_Lhs._Equal(_Rhs));
}
// FUNCTION TEMPLATES operator< FOR basic_string_view
template<class _Elem,
class _Traits>
_NODISCARD constexpr bool operator<(const basic_string_view<_Elem, _Traits> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // less-than compare basic_string_view instances
return (_Lhs.compare(_Rhs) < 0);
}
template<class _Elem,
class _Traits,
int = 1> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator<(const _Identity_t<basic_string_view<_Elem, _Traits>> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // less-than compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) < 0);
}
template<class _Elem,
class _Traits,
int = 2> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator<(const basic_string_view<_Elem, _Traits> _Lhs,
const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept
{ // less-than compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) < 0);
}
// FUNCTION TEMPLATES operator> FOR basic_string_view
template<class _Elem,
class _Traits>
_NODISCARD constexpr bool operator>(const basic_string_view<_Elem, _Traits> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // greater-than compare basic_string_view instances
return (_Lhs.compare(_Rhs) > 0);
}
template<class _Elem,
class _Traits,
int = 1> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator>(const _Identity_t<basic_string_view<_Elem, _Traits>> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // greater-than compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) > 0);
}
template<class _Elem,
class _Traits,
int = 2> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator>(const basic_string_view<_Elem, _Traits> _Lhs,
const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept
{ // greater-than compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) > 0);
}
// FUNCTION TEMPLATES operator<= FOR basic_string_view
template<class _Elem,
class _Traits>
_NODISCARD constexpr bool operator<=(const basic_string_view<_Elem, _Traits> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // less-than-or-equal compare basic_string_view instances
return (_Lhs.compare(_Rhs) <= 0);
}
template<class _Elem,
class _Traits,
int = 1> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator<=(const _Identity_t<basic_string_view<_Elem, _Traits>> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // less-than-or-equal compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) <= 0);
}
template<class _Elem,
class _Traits,
int = 2> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator<=(const basic_string_view<_Elem, _Traits> _Lhs,
const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept
{ // less-than-or-equal compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) <= 0);
}
// FUNCTION TEMPLATES operator>= FOR basic_string_view
template<class _Elem,
class _Traits>
_NODISCARD constexpr bool operator>=(const basic_string_view<_Elem, _Traits> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // greater-than-or-equal compare basic_string_view instances
return (_Lhs.compare(_Rhs) >= 0);
}
template<class _Elem,
class _Traits,
int = 1> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator>=(const _Identity_t<basic_string_view<_Elem, _Traits>> _Lhs,
const basic_string_view<_Elem, _Traits> _Rhs) noexcept
{ // greater-than-or-equal compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) >= 0);
}
template<class _Elem,
class _Traits,
int = 2> // TRANSITION, VSO#409326
_NODISCARD constexpr bool operator>=(const basic_string_view<_Elem, _Traits> _Lhs,
const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept
{ // greater-than-or-equal compare objects convertible to basic_string_view instances
return (_Lhs.compare(_Rhs) >= 0);
}
// TYPEDEFS FOR basic_string_view
using string_view = basic_string_view<char>;
using u16string_view = basic_string_view<char16_t>;
using u32string_view = basic_string_view<char32_t>;
using wstring_view = basic_string_view<wchar_t>;
// STRUCT TEMPLATE SPECIALIZATION hash FOR basic_string_view
template<class _Elem,
class _Traits>
struct hash<basic_string_view<_Elem, _Traits>>
{ // hash functor for basic_string_view
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef basic_string_view<_Elem, _Traits> argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t result_type;
_NODISCARD size_t operator()(const basic_string_view<_Elem, _Traits> _Keyval) const noexcept
{ // hash _Keyval to size_t value by pseudorandomizing transform
return (_Hash_array_representation(_Keyval.data(), _Keyval.size()));
}
};
#endif /* _HAS_CXX17 */
template
<
class
>
class
:
public
{
public
:
using
=
random_access_iterator_tag
;
using
=
typename
::value_type;
using
=
typename
::difference_type;
using
=
typename
::const_pointer;
using
=
const
&;
()
: _Ptr()
{
}
(
,
const
*
)
: _Ptr(
)
{
this
->
(
);
}
_NODISCARD reference operator*() const
{
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Ptr, "cannot dereference value-initialized string iterator");
do
{
if
(
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1424
,
0
,
"%s"
,
"cannot dereference value-initialized string iterator"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot dereference value-initialized string iterator\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1424
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
static_cast
<
const
*>(
this
->
());
_STL_VERIFY(_Mycont, "cannot dereference string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)");
do
{
if
(
_Mycont
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1427
,
0
,
"%s"
,
"cannot dereference string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot dereference string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1427
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
_Mycont
->_Myptr();
const
auto
=
(
);
_STL_VERIFY(_Contptr <= _Rawptr && _Rawptr < _Contptr + _Mycont->_Mysize,
"cannot dereference string iterator because it is out of range (e.g. an end iterator)");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
do
{
if
(
_Contptr
<=
_Rawptr
&&
_Rawptr
<
_Contptr
+
_Mycont
->_Mysize) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1431
,
0
,
"%s"
,
"cannot dereference string iterator because it is out of range (e.g. an end iterator)"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot dereference string iterator because it is out of range (e.g. an end iterator)\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1431
,
0
); }
while
(
false
); } ; }
while
(
false
);
_Analysis_assume_(_Ptr);
;
return
(*
);
}
_NODISCARD pointer operator->() const
{
return
(
<
>::
(
*
this
));
}
&
()
{
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Ptr, "cannot increment value-initialized string iterator");
do
{
if
(
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1446
,
0
,
"%s"
,
"cannot increment value-initialized string iterator"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot increment value-initialized string iterator\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1446
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
static_cast
<
const
*>(
this
->
());
_STL_VERIFY(_Mycont, "cannot increment string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)");
do
{
if
(
_Mycont
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1449
,
0
,
"%s"
,
"cannot increment string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot increment string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1449
,
0
); }
while
(
false
); } ; }
while
(
false
);
_STL_VERIFY(_Unfancy(_Ptr) < _Mycont->_Myptr() + _Mycont->_Mysize,
"cannot increment string iterator past end");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
do
{
if
(
(
) <
_Mycont
->_Myptr() +
_Mycont
->_Mysize) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1451
,
0
,
"%s"
,
"cannot increment string iterator past end"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot increment string iterator past end\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1451
,
0
); }
while
(
false
); } ; }
while
(
false
);
++
;
return
(*
this
);
}
(
int
)
{
= *
this
;
*
this
;
return
(
_Tmp
);
}
&
()
{
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Ptr, "cannot decrement value-initialized string iterator");
do
{
if
(
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1468
,
0
,
"%s"
,
"cannot decrement value-initialized string iterator"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot decrement value-initialized string iterator\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1468
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
static_cast
<
const
*>(
this
->
());
_STL_VERIFY(_Mycont, "cannot decrement string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)");
do
{
if
(
_Mycont
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1471
,
0
,
"%s"
,
"cannot decrement string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot decrement string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1471
,
0
); }
while
(
false
); } ; }
while
(
false
);
_STL_VERIFY(_Mycont->_Myptr() < _Unfancy(_Ptr), "cannot decrement string iterator before begin");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
do
{
if
(
_Mycont
->_Myptr() <
(
)) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1472
,
0
,
"%s"
,
"cannot decrement string iterator before begin"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot decrement string iterator before begin\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1472
,
0
); }
while
(
false
); } ; }
while
(
false
);
--
;
return
(*
this
);
}
(
int
)
{
= *
this
;
*
this
;
return
(
_Tmp
);
}
void
(
const
)
const
noexcept
{
#if _ITERATOR_DEBUG_LEVEL >= 1
if
(
==
0
)
{
return
;
}
_STL_ASSERT(_Ptr, "cannot seek value-initialized string iterator");
do
{
if
(
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1494
,
0
,
"%s"
,
"cannot seek value-initialized string iterator"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot seek value-initialized string iterator\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1494
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
static_cast
<
const
*>(
this
->
());
_STL_ASSERT(_Mycont, "cannot seek string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)");
do
{
if
(
_Mycont
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1497
,
0
,
"%s"
,
"cannot seek string iterator because the iterator was"
" invalidated (e.g. reallocation occurred, or the string was destroyed)"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot seek string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1497
,
0
); }
while
(
false
); } ; }
while
(
false
);
const
auto
=
_Mycont
->_Myptr();
const
auto
=
(
);
if
(
<
0
)
{
#pragma warning(suppress: 4146) // unary minus operator applied to unsigned type, result still unsigned
#pragma warning(suppress:
4146
)
_STL_VERIFY(_Contptr - _Rawptr <= _Off, "cannot seek string iterator before begin");
do
{
if
(
_Contptr
-
_Rawptr
<=
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1504
,
0
,
"%s"
,
"cannot seek string iterator before begin"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot seek string iterator before begin\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1504
,
0
); }
while
(
false
); } ; }
while
(
false
);
}
if
(
>
0
)
{
using
=
typename
::size_type;
const
auto
=
_Mycont
->_Mysize -
static_cast
<
>(
_Rawptr
-
_Contptr
);
_STL_VERIFY(static_cast<_Size_type>(_Off) <= _Left, "cannot seek string iterator after end");
do
{
if
(
static_cast
<
>(
) <=
_Left
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1511
,
0
,
"%s"
,
"cannot seek string iterator after end"
)) || (__debugbreak(),
0
)); ::
(
L"\"cannot seek string iterator after end\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1511
,
0
); }
while
(
false
); } ; }
while
(
false
);
}
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
(void)_Off;
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
}
&
(
const
)
{
#if _ITERATOR_DEBUG_LEVEL >= 1
(
);
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
+=
;
return
(*
this
);
}
_NODISCARD _String_const_iterator operator+(const difference_type _Off) const
{
= *
this
;
return
(
_Tmp
+=
);
}
&
(
const
)
{
return
(*
this
+= -
);
}
_NODISCARD _String_const_iterator operator-(const difference_type _Off) const
{
= *
this
;
return
(
_Tmp
-=
);
}
_NODISCARD difference_type operator-(const _String_const_iterator& _Right) const
{
(
);
return
(
-
.
);
}
_NODISCARD reference operator[](const difference_type _Off) const
{
return
(*(*
this
+
));
}
_NODISCARD bool operator==(const _String_const_iterator& _Right) const
{
(
);
return
(
==
.
);
}
_NODISCARD bool operator!=(const _String_const_iterator& _Right) const
{
return
(!(*
this
));
}
_NODISCARD bool operator<(const _String_const_iterator& _Right) const
{
(
);
return
(
<
.
);
}
_NODISCARD bool operator>(const _String_const_iterator& _Right) const
{
return
(
*
this
);
}
_NODISCARD bool operator<=(const _String_const_iterator& _Right) const
{
return
(!(
*
this
));
}
_NODISCARD bool operator>=(const _String_const_iterator& _Right) const
{
return
(!(*
this
));
}
void
(
const
&
)
const
{
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(this->_Getcont() == _Right._Getcont(), "string iterators incompatible (e.g."
" point to different string instances)");
do
{
if
(
this
->
()
.
()) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1591
,
0
,
"%s"
,
"string iterators incompatible (e.g."
" point to different string instances)"
)) || (__debugbreak(),
0
)); ::
(
L"\"string iterators incompatible (e.g.\" \" point to different string instances)\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1591
,
0
); }
while
(
false
); } ; }
while
(
false
);
#else /* ^^^ _ITERATOR_DEBUG_LEVEL >= 1 ^^^ // vvv _ITERATOR_DEBUG_LEVEL == 0 vvv */
(void)_Right;
#endif /* _ITERATOR_DEBUG_LEVEL */
}
#if _ITERATOR_DEBUG_LEVEL >= 1
friend
void
(
const
&
,
const
&
)
{
_STL_VERIFY(_First._Getcont() == _Last._Getcont(),
"string iterators in range are from different containers");
do
{
if
(
.
()
.
()) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1601
,
0
,
"%s"
,
"string iterators in range are from different containers"
)) || (__debugbreak(),
0
)); ::
(
L"\"string iterators in range are from different containers\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1601
,
0
); }
while
(
false
); } ; }
while
(
false
);
_STL_VERIFY(_First._Ptr <= _Last._Ptr, "string iterator range transposed");
do
{
if
(
.
<=
.
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1602
,
0
,
"%s"
,
"string iterator range transposed"
)) || (__debugbreak(),
0
)); ::
(
L"\"string iterator range transposed\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
1602
,
0
); }
while
(
false
); } ; }
while
(
false
);
}
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
_NODISCARD pointer _Unwrapped() const
{
return
(
);
}
void
(
)
{
=
;
}
;
};
template
<
class
>
_NODISCARD inline _String_const_iterator<_Mystr> operator+(
typename
<
>::
,
<
>
)
{
return
(
+=
);
}
template
<
class
>
class
:
public
<
>
{
public
:
using
=
<
>;
using
=
random_access_iterator_tag
;
using
=
typename
::value_type;
using
=
typename
::difference_type;
using
=
typename
::pointer;
using
=
&;
()
{
}
(
,
const
*
)
:
(
,
)
{
}
_NODISCARD reference operator*() const
{
return
(
const_cast
<
>(
::
)));
}
_NODISCARD pointer operator->() const
{
return
(
<
>::
(
*
this
));
}
&
()
{
*(
*)
this
;
return
(*
this
);
}
(
int
)
{
= *
this
;
*
this
;
return
(
_Tmp
);
}
&
()
{
*(
*)
this
;
return
(*
this
);
}
(
int
)
{
= *
this
;
*
this
;
return
(
_Tmp
);
}
&
(
const
)
{
*(
*)
this
+=
;
return
(*
this
);
}
_NODISCARD _String_iterator operator+(const difference_type _Off) const
{
= *
this
;
return
(
_Tmp
+=
);
}
&
(
const
)
{
return
(*
this
+= -
);
}
_NODISCARD _String_iterator operator-(const difference_type _Off) const
{
= *
this
;
return
(
_Tmp
-=
);
}
_NODISCARD difference_type operator-(const _Mybase& _Right) const
{
return
(*(
*)
this
);
}
_NODISCARD reference operator[](const difference_type _Off) const
{
return
(*(*
this
+
));
}
_NODISCARD pointer _Unwrapped() const
{
return
(
(
this
->
));
}
};
template
<
class
>
_NODISCARD inline _String_iterator<_Mystr> operator+(
typename
<
>::
,
<
>
)
{
return
(
+=
);
}
template
<
class
,
class
,
class
,
class
,
class
,
class
,
class
>
struct
{
using
=
;
using
=
;
using
=
;
using
=
;
using
=
;
};
template
<
class
,
class
>
struct
{
using
=
<
,
>;
using
=
<
>;
using
=
<
<
>,
<
>,
<
,
typename
::
,
typename
::
,
typename
::
,
typename
::
,
&,
const
&>>;
};
template
<
class
>
class
:
public
{
public
:
using
=
typename
::value_type;
using
=
typename
::size_type;
using
=
typename
::difference_type;
using
=
typename
::pointer;
using
=
typename
::const_pointer;
using
=
&;
using
=
const
&;
()
: _Bx(),
_Mysize(
0
),
_Myres(
0
)
{
}
enum
{
=
16
/
sizeof
(
)
1
?
1
:
16
/
sizeof
(
)};
enum
{
=
sizeof
(
) <=
1
?
15
:
sizeof
(
) <=
2
?
7
:
sizeof
(
) <=
4
?
3
:
sizeof
(
) <=
8
?
1
:
0
};
*
()
{
*
=
.
;
if
(
())
{
_Result
=
(
.
);
}
return
(
_Result
);
}
const
*
()
const
{
const
*
=
.
;
if
(
())
{
_Result
=
(
.
);
}
return
(
_Result
);
}
bool
()
const
{
return
(
<=
);
}
void
(
const
)
const
{
if
(
<
)
{
();
}
}
void
(
const
)
const
{
if
(
<=
)
{
();
}
}
[[noreturn]]
static
void
()
{
(
"invalid string position"
);
}
(
const
,
const
)
const
noexcept
{
return
(
(
,
-
));
}
union
{
()
{
}
()
noexcept
{
}
[
];
;
char
[
];
}
;
;
;
};
template
<
class
>
class
{
public
:
using
=
typename
::_Alty;
using
=
typename
::_Alty_traits;
using
=
<
,
>;
using
=
<
>;
using
=
typename
::_Val_types;
using
=
<
>;
using
=
typename
::
;
using
=
typename
::value_type;
using
=
typename
::size_type;
using
=
typename
::difference_type;
using
=
typename
::pointer;
using
=
typename
::const_pointer;
using
=
&;
using
=
const
&;
using
=
<
>;
using
=
<
>;
enum
{
=
::
};
enum
{
=
::
};
#if _ITERATOR_DEBUG_LEVEL == 0
_String_alloc()
: _Mypair(_Zero_then_variadic_args_t())
{ // default construct allocator
}
template<class _Any_alloc,
class = enable_if_t<!is_same_v<remove_cv_t<remove_reference_t<_Any_alloc>>, _String_alloc>>>
_String_alloc(_Any_alloc&& _Al)
: _Mypair(_One_then_variadic_args_t(),
_STD forward<_Any_alloc>(_Al))
{ // construct allocator from _Al
}
void _Copy_alloc(const _Alty& _Al)
{ // replace old allocator
_Pocca(_Getal(), _Al);
}
void _Move_alloc(_Alty& _Al)
{ // replace old allocator
_Pocma(_Getal(), _Al);
}
#else /* _ITERATOR_DEBUG_LEVEL == 0 */
()
: _Mypair(
_Zero_then_variadic_args_t
())
{
();
}
template
<
class
,
class
=
<!
<
<
<
>>,
>>>
(
&&
)
: _Mypair(
_One_then_variadic_args_t
(),
_STD forward<_Any_alloc>(_Al))
{
();
}
()
noexcept
{
();
}
void
(
const
&
)
{
const
bool
=
::propagate_on_container_copy_assignment::value
&&
() !=
;
if
(
_Reload
)
{
();
}
(
(),
);
if
(
_Reload
)
{
();
}
}
void
(
&
)
{
const
bool
=
::propagate_on_container_move_assignment::value
&&
() !=
;
if
(
_Reload
)
{
();
}
(
(),
);
if
(
_Reload
)
{
();
}
}
void
()
{
(
());
() =
(
_Proxy_allocator
.
(
1
));
::
(
_Proxy_allocator
,
(),
());
_Myproxy()->_Mycont = _STD addressof(_Get_data());
}
void
()
{
(
());
();
::
(
_Proxy_allocator
,
());
(
_Proxy_allocator
,
());
() =
nullptr
;
}
**
()
const
{
return
(
().
());
}
* &
()
noexcept
{
return
(
().
);
}
*
const
&
()
const
noexcept
{
return
(
().
);
}
#endif /* _ITERATOR_DEBUG_LEVEL == 0 */
void
()
{
().
();
}
void
(
&
)
{
().
(
.
());
}
&
()
noexcept
{
return
(
.
());
}
const
&
()
const
noexcept
{
return
(
.
());
}
&
()
noexcept
{
return
(
.
());
}
const
&
()
const
noexcept
{
return
(
.
());
}
private
:
<
,
>
;
};
template
<
class
>
constexpr
=
<
> ?
0
:
sizeof
(
);
template
<
class
,
class
=
<
>,
class
=
<
>>
class
:
public
<
<
,
>>
{
public
:
static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Elem, typename _Alloc::value_type>,
static_assert
(!
0
||
<
,
typename
::value_type>,
_MISMATCHED_ALLOCATOR_MESSAGE("basic_string<T, Traits, Allocator>", "T"));
"basic_string<T, Traits, Allocator>"
" requires that Allocator's value_type match "
"T"
" (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)"
" Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0"
" to suppress this diagnostic."
);
static_assert
(
<
,
typename
::char_type>,
"N4659 24.3.2.1 [string.require]/3 requires that the supplied "
"char_traits character type match the string's character type."
);
using
=
<
<
,
>>;
using
=
;
using
=
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
typename
::
;
using
=
&;
using
=
const
&;
using
=
typename
::
;
using
=
typename
::
;
using reverse_iterator = _STD reverse_iterator<iterator>;
using const_reverse_iterator = _STD reverse_iterator<const_iterator>;
using
=
<
<
,
> &&
<
>>;
static
constexpr
=
<
>;
static
constexpr
=
sizeof
(
) -
;
template
<
class
>
using
=
<
<
,
const
*
const
,
*
const
,
const
*,
*>>;
#if _HAS_CXX17
template<class _StringViewIsh>
using _Is_string_view_ish = enable_if_t<conjunction_v<
is_convertible<const _StringViewIsh&, basic_string_view<_Elem, _Traits>>,
negation<is_convertible<const _StringViewIsh&, const _Elem *>>>>;
#endif /* _HAS_CXX17 */
(
const
&
)
:
(
::
select_on_container_copy_construction
(
.
()))
{
(
);
}
(
const
&
,
const
&
)
:
(
)
{
(
);
}
basic_string() _NOEXCEPT_COND(is_nothrow_default_constructible_v<_Alty>)
()
noexcept
(
is_nothrow_default_constructible_v
<
>)
:
()
{
();
}
explicit
(
const
&
)
noexcept
:
(
)
{
();
}
(
const
&
,
const
,
const
&
=
())
:
(
)
{
();
(
,
,
);
}
(
const
&
,
const
,
const
,
const
&
=
())
:
(
)
{
();
(
,
,
);
}
basic_string(_In_reads_(_Count) const _Elem * const _Ptr, _CRT_GUARDOVERFLOW const size_type _Count)
(
const
*
const
,
__declspec
(guard(overflow))
const
)
:
()
{
();
(
,
);
}
basic_string(_In_reads_(_Count) const _Elem * const _Ptr, _CRT_GUARDOVERFLOW const size_type _Count,
(
const
*
const
,
__declspec
(guard(overflow))
const
,
const
&
)
:
(
)
{
();
(
,
);
}
basic_string(_In_z_ const _Elem * const _Ptr)
:
()
{
();
(
);
}
#if _HAS_CXX17
template<class _Alloc2 = _Alloc,
enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0>
#endif /* _HAS_CXX17 */
basic_string(_In_z_ const _Elem * const _Ptr, const _Alloc& _Al)
(
const
*
const
,
const
&
)
:
(
)
{
();
(
);
}
basic_string(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch)
(
__declspec
(guard(overflow))
const
,
const
)
:
()
{
();
(
,
);
}
#if _HAS_CXX17
template<class _Alloc2 = _Alloc,
enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0>
#endif /* _HAS_CXX17 */
basic_string(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch, const _Alloc& _Al)
(
__declspec
(guard(overflow))
const
,
const
,
const
&
)
:
(
)
{
();
(
,
);
}
template
<
class
,
class
=
<
<
>>>
(
,
,
const
&
=
())
:
(
)
{
();
(
,
);
(
(
),
(
),
<
>());
}
template
<
class
>
void
(
,
const
,
)
{
for
(;
!=
; ++
)
{
(
static_cast
<
>(*
));
}
();
}
template
<
class
>
void
(
const
,
const
,
)
{
const size_type _Count = _Convert_size<size_type>(static_cast<size_t>(_STD distance(_First, _Last)));
const
=
<
>(
static_cast
<
>(::
std
::
(
,
)));
(
_Count
);
(
,
,
());
}
void
(
*
const
,
*
const
,
random_access_iterator_tag
)
{
if
(
)
{
(
,
<
>(
static_cast
<
>(
-
)));
}
}
void
(
const
*
const
,
const
*
const
,
random_access_iterator_tag
)
{
if
(
)
{
(
,
<
>(
static_cast
<
>(
-
)));
}
}
(
&&
)
noexcept
: _Mybase(_STD move(_Right._Getal()))
{
_Assign_rv_contents_with_alloc_always_equal(_STD move(_Right), _Use_memcpy_move{});
_Assign_rv_contents_with_alloc_always_equal
(::
std
::
(
),
{});
}
(
&&
,
const
&
)
_NOEXCEPT_COND(_Alty_traits::is_always_equal::value) // strengthened
:
(
)
{
_Assign_rv_contents(_STD move(_Right), typename _Alty_traits::is_always_equal{});
(::
std
::
(
),
typename
::
{});
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
explicit basic_string(const _StringViewIsh& _Right, const _Alloc& _Al = _Alloc())
: _Mybase(_Al)
{ // construct from _Right using _Al
_Tidy_init();
assign(_Right);
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string(const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count,
const _Alloc& _Al = _Alloc())
: _Mybase(_Al)
{ // construct from _Right [_Roff, _Roff + _Count) using _Al
_Tidy_init();
assign(_Right, _Roff, _Count);
}
#endif /* _HAS_CXX17 */
basic_string& operator=(basic_string&& _Right) _NOEXCEPT_COND(_Always_equal_after_move<_Alty>)
{
if (this != _STD addressof(_Right))
{
();
this
->
(
.
());
_Assign_rv_contents(_STD move(_Right), bool_constant<_Always_equal_after_move<_Alty>>{});
}
return
(*
this
);
}
basic_string& assign(basic_string&& _Right) _NOEXCEPT_COND(_Always_equal_after_move<_Alty>)
{
*this = _STD move(_Right);
return
(*
this
);
}
void
(
&&
,
)
noexcept
{
_Assign_rv_contents_with_alloc_always_equal(_STD move(_Right), _Use_memcpy_move{});
_Assign_rv_contents_with_alloc_always_equal
(::
std
::
(
),
{});
}
void
(
&&
,
)
{
if
(
this
->
()
.
())
{
_Assign_rv_contents_with_alloc_always_equal(_STD move(_Right), _Use_memcpy_move{});
_Assign_rv_contents_with_alloc_always_equal
(::
std
::
(
),
{});
}
else
{
(
);
}
}
void
_Assign_rv_contents_with_alloc_always_equal
(
&&
,
)
noexcept
{
auto
&
=
.
();
#if _ITERATOR_DEBUG_LEVEL != 0
if
(
_Right_data
.
())
{
this
->
(
);
}
else
{
.
();
}
#endif /* _ITERATOR_DEBUG_LEVEL != 0 */
const auto _My_data_mem = reinterpret_cast<unsigned char *>(_STD addressof(this->_Get_data()))
const
auto
=
reinterpret_cast
<
unsigned
char
*>(::
std
::
(
this
->
()))
+
;
const auto _Right_data_mem = reinterpret_cast<unsigned char *>(_STD addressof(_Right_data))
const
auto
=
reinterpret_cast
<
unsigned
char
*>(::
std
::
(
_Right_data
))
+
;
_CSTD memcpy(_My_data_mem, _Right_data_mem, _Memcpy_move_size);
::
(
_My_data_mem
,
_Right_data_mem
,
);
.
();
}
void
_Assign_rv_contents_with_alloc_always_equal
(
&&
,
)
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
if
(
_Right_data
.
())
{
_Alty_traits::construct(this->_Getal(), _STD addressof(_My_data._Bx._Ptr), _Right_data._Bx._Ptr);
::
(
this
->
(), ::
std
::
(
_My_data
.
.
),
_Right_data
.
.
);
_Right_data
.
.
=
();
this
->
(
);
}
else
{
::copy(
_My_data
.
.
,
_Right_data
.
.
,
_Right_data
.
+
1
);
.
();
}
_My_data
.
=
_Right_data
.
;
_My_data
.
=
_Right_data
.
;
.
();
}
void
(
const
&
)
{
auto
&
=
this
->
();
auto
&
=
.
();
const
=
_Right_data
.
;
const
*
const
=
_Right_data
.
();
if
(
_Right_size
this
->
)
{
::copy(
_My_data
.
.
,
_Right_ptr
,
this
->
);
_My_data
.
=
_Right_size
;
_My_data
.
=
this
->
-
1
;
return
;
}
auto
&
=
this
->
();
const
=
(
_Right_size
|
this
->
,
());
const
=
_Al
.
(
_New_capacity
+
1
);
_Alty_traits::construct(_Al, _STD addressof(_My_data._Bx._Ptr), _New_array);
::
(
_Al
, ::
std
::
(
_My_data
.
.
),
_New_array
);
::copy(
(
_New_array
),
_Right_ptr
,
_Right_size
+
1
);
_My_data
.
=
_Right_size
;
_My_data
.
=
_New_capacity
;
}
(
<
>
,
const
&
=
())
:
(
)
{
();
(
.
(),
<
>(
.
()));
}
&
(
<
>
)
{
return
(
(
.
(),
<
>(
.
())));
}
&
(
<
>
)
{
return
(
(
.
(),
<
>(
.
())));
}
&
(
<
>
)
{
return
(
(
.
(),
<
>(
.
())));
}
&
(
<
>
)
{
return
(
(
.
(),
<
>(
.
())));
}
(
const
,
const
<
>
)
{
const
=
();
(
static_cast
<
>(
_Off
),
.
(),
<
>(
.
()));
return
(
()
_Off
);
}
&
(
const
,
const
,
const
<
>
)
{
return
(
(
static_cast
<
>(
()),
static_cast
<
>(
),
.
(),
<
>(
.
())));
}
()
noexcept
{
();
}
static
constexpr
auto
{
static_cast
<
>(-
1
)};
&
(
const
&
)
{
if (this != _STD addressof(_Right))
{
#pragma warning(push)
#pragma warning(disable: 4127) // conditional expression is constant
#pragma warning(disable:
4127
)
if
(
::
propagate_on_container_copy_assignment
::
&&
this
->
() !=
.
())
{
();
}
#pragma warning(pop)
this
->
(
.
());
auto
&
=
.
();
(
_Right_data
.
(),
_Right_data
.
);
}
return
(*
this
);
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& operator=(const _StringViewIsh& _Right)
{ // assign _Right
return (assign(_Right));
}
#endif /* _HAS_CXX17 */
basic_string& operator=(_In_z_ const _Elem * const _Ptr)
{
return
(
(
));
}
&
(
const
)
{
auto
&
=
this
->
();
_My_data
.
=
1
;
*
const
=
_My_data
.
();
::assign(
_Ptr
[
0
],
);
::assign(
_Ptr
[
1
],
());
return
(*
this
);
}
&
(
const
&
)
{
return
(
(
));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& operator+=(const _StringViewIsh& _Right)
{ // append _Right
return (append(_Right));
}
#endif /* _HAS_CXX17 */
basic_string& operator+=(_In_z_ const _Elem * const _Ptr)
{
return
(
(
));
}
&
(
)
{
(
);
return
(*
this
);
}
&
(
const
&
)
{
auto
&
=
.
();
return
(
(
_Right_data
.
(),
_Right_data
.
));
}
&
(
const
&
,
const
,
=
)
{
auto
&
=
.
();
_Right_data
.
(
);
=
_Right_data
.
(
,
);
return
(
(
_Right_data
.
() +
,
));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& append(const _StringViewIsh& _Right)
{ // append _Right
const basic_string_view<_Elem, _Traits> _As_view = _Right;
return (append(_As_view.data(), _Convert_size<size_type>(_As_view.size())));
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& append(const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos)
{ // append _Right [_Roff, _Roff + _Count)
basic_string_view<_Elem, _Traits> _As_view = _Right;
return (append(_As_view.substr(_Roff, _Count)));
}
#endif /* _HAS_CXX17 */
basic_string& append(_In_reads_(_Count) const _Elem * const _Ptr, _CRT_GUARDOVERFLOW const size_type _Count)
&
(
const
*
const
,
__declspec
(guard(overflow))
const
)
{
auto
&
=
this
->
();
const
=
_My_data
.
;
if
(
<=
_My_data
.
-
_Old_size
)
{
_My_data
.
=
_Old_size
+
;
*
const
=
_My_data
.
();
::move(
_Old_ptr
+
_Old_size
,
,
);
::assign(
_Old_ptr
[
_Old_size
+
],
());
return
(*
this
);
}
return
(
(
,
[](
*
const
,
const
*
const
,
const
,
const
*
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Old_size
);
::copy(
_New_ptr
+
_Old_size
,
_Ptr
,
_Count
);
::assign(
_New_ptr
[
_Old_size
+
_Count
],
());
},
,
));
}
basic_string& append(_In_z_ const _Elem * const _Ptr)
{
return
(
(
,
<
>(
::length(
))));
}
basic_string& append(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch)
&
(
__declspec
(guard(overflow))
const
,
const
)
{
auto
&
=
this
->
();
const
=
_My_data
.
;
if
(
<=
_My_data
.
-
_Old_size
)
{
_My_data
.
=
_Old_size
+
;
*
const
=
_My_data
.
();
::assign(
_Old_ptr
+
_Old_size
,
,
);
::assign(
_Old_ptr
[
_Old_size
+
],
());
return
(*
this
);
}
return
(
(
,
[](
*
const
,
const
*
const
,
const
,
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Old_size
);
::assign(
_New_ptr
+
_Old_size
,
_Count
,
_Ch
);
::assign(
_New_ptr
[
_Old_size
+
_Count
],
());
},
,
));
}
template
<
class
,
class
=
<
<
>>>
&
(
const
,
const
)
{
return
(
(
(),
(),
,
));
}
&
(
const
&
)
{
*
this
;
return
(*
this
);
}
&
(
const
&
,
const
,
=
)
{
auto
&
=
.
();
_Right_data
.
(
);
=
_Right_data
.
(
,
);
return
(
(
_Right_data
.
() +
,
));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& assign(const _StringViewIsh& _Right)
{ // assign _Right
const basic_string_view<_Elem, _Traits> _As_view = _Right;
return (assign(_As_view.data(), _Convert_size<size_type>(_As_view.size())));
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& assign(const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos)
{ // assign _Right [_Roff, _Roff + _Count)
basic_string_view<_Elem, _Traits> _As_view = _Right;
return (assign(_As_view.substr(_Roff, _Count)));
}
#endif /* _HAS_CXX17 */
basic_string& assign(_In_reads_(_Count) const _Elem * const _Ptr, _CRT_GUARDOVERFLOW const size_type _Count)
&
(
const
*
const
,
__declspec
(guard(overflow))
const
)
{
auto
&
=
this
->
();
if
(
<=
_My_data
.
)
{
*
const
=
_My_data
.
();
_My_data
.
=
;
::move(
_Old_ptr
,
,
);
::assign(
_Old_ptr
[
],
());
return
(*
this
);
}
return
(
(
, [](
*
const
,
const
,
const
*
const
) {
::copy(
_New_ptr
,
_Ptr
,
_Count
);
::assign(
_New_ptr
[
_Count
],
());
},
));
}
basic_string& assign(_In_z_ const _Elem * const _Ptr)
{
return
(
(
,
<
>(
::length(
))));
}
basic_string& assign(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch)
&
(
__declspec
(guard(overflow))
const
,
const
)
{
auto
&
=
this
->
();
if
(
<=
_My_data
.
)
{
*
const
=
_My_data
.
();
_My_data
.
=
;
::assign(
_Old_ptr
,
,
);
::assign(
_Old_ptr
[
],
());
return
(*
this
);
}
return
(
(
, [](
*
const
,
const
,
const
) {
::assign(
_New_ptr
,
_Count
,
_Ch
);
::assign(
_New_ptr
[
_Count
],
());
},
));
}
template
<
class
,
class
=
<
<
>>>
&
(
const
,
const
)
{
return
(
(
(),
(),
,
));
}
&
(
const
,
const
&
)
{
auto
&
=
.
();
return
(
(
,
_Right_data
.
(),
_Right_data
.
));
}
&
(
const
,
const
&
,
const
,
=
)
{
auto
&
=
.
();
_Right_data
.
(
);
=
_Right_data
.
(
,
);
return
(
(
,
_Right_data
.
() +
,
));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& insert(const size_type _Off, const _StringViewIsh& _Right)
{ // insert _Right at _Off
const basic_string_view<_Elem, _Traits> _As_view = _Right;
return (insert(_Off, _As_view.data(), _Convert_size<size_type>(_As_view.size())));
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& insert(const size_type _Off,
const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos)
{ // insert _Right [_Roff, _Roff + _Count) at _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
return (insert(_Off, _As_view.substr(_Roff, _Count)));
}
#endif /* _HAS_CXX17 */
basic_string& insert(const size_type _Off, _In_reads_(_Count) const _Elem * const _Ptr,
&
(
const
,
const
*
const
,
_CRT_GUARDOVERFLOW const size_type _Count)
__declspec
(guard(overflow))
const
)
{
auto
&
=
this
->
();
_My_data
.
(
);
const
=
_My_data
.
;
if
(
<=
_My_data
.
-
_Old_size
)
{
_My_data
.
=
_Old_size
+
;
*
const
=
_My_data
.
();
*
const
=
_Old_ptr
+
;
;
if
(
+
<=
_Insert_at
||
>
_Old_ptr
+
_Old_size
)
{
_Ptr_shifted_after
=
;
}
else
if
(
_Insert_at
<=
)
{
_Ptr_shifted_after
=
0
;
}
else
{
_Ptr_shifted_after
=
static_cast
<
>(
_Insert_at
-
);
}
::move(
_Insert_at
+
,
_Insert_at
,
_Old_size
-
+
1
);
::copy(
_Insert_at
,
,
_Ptr_shifted_after
);
::copy(
_Insert_at
+
_Ptr_shifted_after
,
+
+
_Ptr_shifted_after
,
-
_Ptr_shifted_after
);
return
(*
this
);
}
return
(
(
,
[](
*
const
,
const
*
const
,
const
,
const
,
const
*
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Off
);
::copy(
_New_ptr
+
_Off
,
_Ptr
,
_Count
);
::copy(
_New_ptr
+
_Off
+
_Count
,
_Old_ptr
+
_Off
,
_Old_size
-
_Off
+
1
);
},
,
,
));
}
basic_string& insert(const size_type _Off, _In_z_ const _Elem * const _Ptr)
&
(
const
,
const
*
const
)
{
return
(
(
,
,
<
>(
::length(
))));
}
basic_string& insert(const size_type _Off, _CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch)
&
(
const
,
__declspec
(guard(overflow))
const
,
const
)
{
auto
&
=
this
->
();
_My_data
.
(
);
const
=
_My_data
.
;
if
(
<=
_My_data
.
-
_Old_size
)
{
_My_data
.
=
_Old_size
+
;
*
const
=
_My_data
.
();
*
const
=
_Old_ptr
+
;
::move(
_Insert_at
+
,
_Insert_at
,
_Old_size
-
+
1
);
::assign(
_Insert_at
,
,
);
return
(*
this
);
}
return
(
(
,
[](
*
const
,
const
*
const
,
const
,
const
,
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Off
);
::assign(
_New_ptr
+
_Off
,
_Count
,
_Ch
);
::copy(
_New_ptr
+
_Off
+
_Count
,
_Old_ptr
+
_Off
,
_Old_size
-
_Off
+
1
);
},
,
,
));
}
(
const
,
const
)
{
const
=
();
(
static_cast
<
>(
_Off
),
1
,
);
return
(
()
_Off
);
}
iterator insert(const const_iterator _Where, _CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch)
(
const
,
__declspec
(guard(overflow))
const
,
const
)
{
const
=
();
(
static_cast
<
>(
_Off
),
,
);
return
(
()
_Off
);
}
template
<
class
,
class
=
<
<
>>>
(
const
,
const
,
const
)
{
const
=
();
(
,
,
,
);
return
(
()
_Off
);
}
&
(
const
=
0
)
{
auto
&
=
this
->
();
_My_data
.
(
);
(
);
return
(*
this
);
}
&
(
const
,
)
{
auto
&
=
this
->
();
_My_data
.
(
);
=
_My_data
.
(
,
);
const
=
_My_data
.
;
*
const
=
_My_data
.
();
*
const
=
_My_ptr
+
;
const
=
_Old_size
-
;
_My_data
.
=
_New_size
;
::move(
_Erase_at
,
_Erase_at
+
,
_New_size
-
+
1
);
return
(*
this
);
}
(
const
)
{
const
=
();
(
static_cast
<
>(
_Off
),
1
);
return
(
()
_Off
);
}
(
const
,
const
)
{
(
,
);
const
=
();
(
static_cast
<
>(
_Off
),
static_cast
<
>(
));
return
(
()
_Off
);
}
void
()
noexcept
{
(
0
);
}
&
(
const
,
const
,
const
&
)
{
auto
&
=
.
();
return
(
(
,
,
_Right_data
.
(),
_Right_data
.
));
}
&
(
const
,
,
const
&
,
const
,
=
)
{
auto
&
=
.
();
_Right_data
.
(
);
=
_Right_data
.
(
,
);
return
(
(
,
,
_Right_data
.
() +
,
));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& replace(const size_type _Off, const size_type _N0, const _StringViewIsh& _Right)
{ // replace [_Off, _Off + _N0) with _Right
basic_string_view<_Elem, _Traits> _As_view = _Right;
return (replace(_Off, _N0, _As_view.data(), _Convert_size<size_type>(_As_view.size())));
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& replace(const size_type _Off, const size_type _N0,
const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos)
{ // replace [_Off, _Off + _N0) with _Right [_Roff, _Roff + _Count)
basic_string_view<_Elem, _Traits> _As_view = _Right;
return (replace(_Off, _N0, _As_view.substr(_Roff, _Count)));
}
#endif /* _HAS_CXX17 */
&
(
const
,
,
_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Count)
{
auto
&
=
this
->
();
_My_data
.
(
);
=
_My_data
.
(
,
);
if
(
)
{
::move(
_My_data
.
() +
,
,
);
return
(*
this
);
}
const
=
_My_data
.
;
const
=
_Old_size
-
-
+
1
;
if
(
)
{
_My_data
.
=
_Old_size
- (
-
);
*
const
=
_My_data
.
();
*
const
=
_Old_ptr
+
;
::move(
_Insert_at
,
,
);
::move(
_Insert_at
+
,
_Insert_at
+
,
_Suffix_size
);
return
(*
this
);
}
const
=
static_cast
<
>(
-
);
if
(
_Growth
<=
_My_data
.
-
_Old_size
)
{
_My_data
.
=
_Old_size
+
_Growth
;
*
const
=
_My_data
.
();
*
const
=
_Old_ptr
+
;
*
const
=
_Insert_at
+
;
;
if
(
+
<=
_Insert_at
||
>
_Old_ptr
+
_Old_size
)
{
_Ptr_shifted_after
=
;
}
else
if
(
_Suffix_at
<=
)
{
_Ptr_shifted_after
=
0
;
}
else
{
_Ptr_shifted_after
=
static_cast
<
>(
_Suffix_at
-
);
}
::move(
_Suffix_at
+
_Growth
,
_Suffix_at
,
_Suffix_size
);
::move(
_Insert_at
,
,
_Ptr_shifted_after
);
::copy(
_Insert_at
+
_Ptr_shifted_after
,
+
_Growth
+
_Ptr_shifted_after
,
-
_Ptr_shifted_after
);
return
(*
this
);
}
return
(
(
_Growth
,
[](
*
const
,
const
*
const
,
const
,
const
,
const
,
const
*
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Off
);
::copy(
_New_ptr
+
_Off
,
_Ptr
,
_Count
);
::copy(
_New_ptr
+
_Off
+
_Count
,
_Old_ptr
+
_Off
+
_N0
,
_Old_size
-
_N0
-
_Off
+
1
);
},
,
,
,
));
}
basic_string& replace(const size_type _Off, const size_type _N0, _In_z_ const _Elem * const _Ptr)
&
(
const
,
const
,
const
*
const
)
{
return
(
(
,
,
,
<
>(
::length(
))));
}
&
(
const
,
,
const
,
const
)
{
auto
&
=
this
->
();
_My_data
.
(
);
=
_My_data
.
(
,
);
if
(
)
{
::assign(
_My_data
.
() +
,
,
);
return
(*
this
);
}
const
=
_My_data
.
;
if
(
||
-
<=
_My_data
.
-
_Old_size
)
{
_My_data
.
=
_Old_size
+
-
;
*
const
=
_My_data
.
();
*
const
=
_Old_ptr
+
;
::move(
_Insert_at
+
,
_Insert_at
+
,
_Old_size
-
-
+
1
);
::assign(
_Insert_at
,
,
);
return
(*
this
);
}
return
(
(
-
,
[](
*
const
,
const
*
const
,
const
,
const
,
const
,
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Off
);
::assign(
_New_ptr
+
_Off
,
_Count
,
_Ch
);
::copy(
_New_ptr
+
_Off
+
_Count
,
_Old_ptr
+
_Off
+
_N0
,
_Old_size
-
_N0
-
_Off
+
1
);
},
,
,
,
));
}
&
(
const
,
const
,
const
&
)
{
return
(
(
static_cast
<
>(
()),
static_cast
<
>(
),
));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
basic_string& replace(const const_iterator _First, const const_iterator _Last, const _StringViewIsh& _Right)
{ // replace [_First, _Last) with _Right
return (replace(static_cast<size_type>(_First - begin()), static_cast<size_type>(_Last - _First), _Right));
}
#endif /* _HAS_CXX17 */
&
(
const
,
const
,
_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Count)
{
return
(
(
static_cast
<
>(
()),
static_cast
<
>(
),
,
));
}
basic_string& replace(const const_iterator _First, const const_iterator _Last, _In_z_ const _Elem * const _Ptr)
&
(
const
,
const
,
const
*
const
)
{
return
(
(
static_cast
<
>(
()),
static_cast
<
>(
),
));
}
&
(
const
,
const
,
const
,
const
)
{
return
(
(
static_cast
<
>(
()),
static_cast
<
>(
),
,
));
}
template
<
class
>
&
(
const
,
const
,
const
,
const
,
)
{
const
(
,
,
());
(
,
,
_Right
);
return
(*
this
);
}
template
<
class
>
&
(
const
,
const
,
const
,
const
,
)
{
return
(
(
static_cast
<
>(
()),
static_cast
<
>(
),
,
static_cast
<
>(
-
)));
}
template
<
class
,
class
=
<
<
>>>
&
(
const
,
const
,
const
,
const
)
{
(
,
);
const
auto
=
(
);
const
auto
=
(
);
return
(
(
,
,
_UFirst2
,
_ULast2
,
<
decltype
(
_UFirst2
)>()));
}
_NODISCARD iterator begin() noexcept
{
auto _My_data = _STD addressof(this->_Get_data());
auto
= ::
std
::
(
this
->
());
return
(
(
<
>(
_My_data
->
()),
_My_data
));
}
_NODISCARD const_iterator begin() const noexcept
{
auto _My_data = _STD addressof(this->_Get_data());
auto
= ::
std
::
(
this
->
());
return
(
(
<
>(
_My_data
->
()),
_My_data
));
}
_NODISCARD iterator end() noexcept
{
auto _My_data = _STD addressof(this->_Get_data());
auto
= ::
std
::
(
this
->
());
return
(
(
<
>(
_My_data
->
())
+
static_cast
<
>(
_My_data
->
),
_My_data
));
}
_NODISCARD const_iterator end() const noexcept
{
auto _My_data = _STD addressof(this->_Get_data());
auto
= ::
std
::
(
this
->
());
return
(
(
<
>(
_My_data
->
())
+
static_cast
<
>(
_My_data
->
),
_My_data
));
}
*
()
noexcept
{
return
(
this
->
().
());
}
const
*
()
const
noexcept
{
return
(
this
->
().
());
}
*
()
noexcept
{
auto
&
=
this
->
();
return
(
_My_data
.
() +
_My_data
.
);
}
const
*
()
const
noexcept
{
const
auto
&
=
this
->
();
return
(
_My_data
.
() +
_My_data
.
);
}
_NODISCARD reverse_iterator rbegin() noexcept
{
return
(
(
()));
}
_NODISCARD const_reverse_iterator rbegin() const noexcept
{
return
(
(
()));
}
_NODISCARD reverse_iterator rend() noexcept
{
return
(
(
()));
}
_NODISCARD const_reverse_iterator rend() const noexcept
{
return
(
(
()));
}
_NODISCARD const_iterator cbegin() const noexcept
{
return
(
());
}
_NODISCARD const_iterator cend() const noexcept
{
return
(
());
}
_NODISCARD const_reverse_iterator crbegin() const noexcept
{
return
(
());
}
_NODISCARD const_reverse_iterator crend() const noexcept
{
return
(
());
}
void
()
{
auto
&
=
this
->
();
if
(!
_My_data
.
())
{
return
;
}
if
(
_My_data
.
this
->
)
{
();
return
;
}
const
=
(
_My_data
.
|
this
->
,
());
if
(
_Target_capacity
_My_data
.
)
{
auto
&
=
this
->
();
const
=
_Al
.
(
_Target_capacity
+
1
);
this
->
();
::copy(
(
_New_ptr
),
(
_My_data
.
.
),
_My_data
.
+
1
);
_Al
.
(
_My_data
.
.
,
_My_data
.
+
1
);
_My_data
.
.
=
_New_ptr
;
_My_data
.
=
_Target_capacity
;
}
}
_NODISCARD reference at(const size_type _Off)
{
auto
&
=
this
->
();
_My_data
.
(
);
return
(
_My_data
.
()[
]);
}
_NODISCARD const_reference at(const size_type _Off) const
{
auto
&
=
this
->
();
_My_data
.
(
);
return
(
_My_data
.
()[
]);
}
_NODISCARD reference operator[](const size_type _Off)
{
auto
&
=
this
->
();
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Off <= _My_data._Mysize, "string subscript out of range");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
do
{
if
(
<=
_My_data
.
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
3204
,
0
,
"%s"
,
"string subscript out of range"
)) || (__debugbreak(),
0
)); ::
(
L"\"string subscript out of range\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
3204
,
0
); }
while
(
false
); } ; }
while
(
false
);
return
(
_My_data
.
()[
]);
}
_NODISCARD const_reference operator[](const size_type _Off) const
{
auto
&
=
this
->
();
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Off <= _My_data._Mysize, "string subscript out of range");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
do
{
if
(
<=
_My_data
.
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
3213
,
0
,
"%s"
,
"string subscript out of range"
)) || (__debugbreak(),
0
)); ::
(
L"\"string subscript out of range\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
3213
,
0
); }
while
(
false
); } ; }
while
(
false
);
return
(
_My_data
.
()[
]);
}
#if _HAS_CXX17
/* implicit */ operator basic_string_view<_Elem, _Traits>() const noexcept
{ // return a string_view around *this's character-type sequence
auto& _My_data = this->_Get_data();
return (basic_string_view<_Elem, _Traits>(_My_data._Myptr(), _My_data._Mysize));
}
#endif /* _HAS_CXX17 */
void
(
const
)
{
auto
&
=
this
->
();
const
=
_My_data
.
;
if
(
_Old_size
_My_data
.
)
{
_My_data
.
=
_Old_size
+
1
;
*
const
=
_My_data
.
();
::assign(
_Ptr
[
_Old_size
],
);
::assign(
_Ptr
[
_Old_size
+
1
],
());
return
;
}
(
1
,
[](
*
const
,
const
*
const
,
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Old_size
);
::assign(
_New_ptr
[
_Old_size
],
_Ch
);
::assign(
_New_ptr
[
_Old_size
+
1
],
());
},
);
}
void
()
{
auto
&
=
this
->
();
const
=
_My_data
.
;
#if _ITERATOR_DEBUG_LEVEL >= 1
_STL_VERIFY(_Old_size != 0, "invalid to pop_back empty string");
#endif /* _ITERATOR_DEBUG_LEVEL >= 1 */
do
{
if
(
_Old_size
0
) { }
else
{
do
{ (
void
) ((
1
(
2
,
"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
3253
,
0
,
"%s"
,
"invalid to pop_back empty string"
)) || (__debugbreak(),
0
)); ::
(
L"\"invalid to pop_back empty string\""
, __LPREFIX( __FUNCTION__),
L"c:\\program files (x86)\\microsoft visual studio\\2017\\professional\\vc\\tools\\msvc\\14.16.27023\\include\\xstring"
,
3253
,
0
); }
while
(
false
); } ; }
while
(
false
);
(
_Old_size
-
1
);
}
_NODISCARD reference front()
{
return
(
());
}
_NODISCARD const_reference front() const
{
return
(
());
}
_NODISCARD reference back()
{
return
(
(
()
1
));
}
_NODISCARD const_reference back() const
{
return
(
(
()
1
));
}
_NODISCARD _Ret_z_ const _Elem * c_str() const noexcept
const
*
()
const
noexcept
{
return
(
this
->
().
());
}
_NODISCARD _Ret_z_ const _Elem * data() const noexcept
const
*
()
const
noexcept
{
return
(
this
->
().
());
}
#if _HAS_CXX17
_NODISCARD _Ret_z_ _Elem * data() noexcept
{ // return pointer to mutable array
return (this->_Get_data()._Myptr());
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type length() const noexcept
{
return
(
this
->
().
);
}
_NODISCARD size_type size() const noexcept
{
return
(
this
->
().
);
}
_NODISCARD size_type max_size() const noexcept
{
const
=
::
(
this
->
());
const
=
(
_Alloc_max
,
static_cast
<
>(
this
->
));
return
(
(
static_cast
<
>((
<
>::
)()),
_Storage_max
-
1
));
}
void resize(_CRT_GUARDOVERFLOW const size_type _Newsize, const _Elem _Ch = _Elem())
void
(
__declspec
(guard(overflow))
const
,
const
=
())
{
const
=
();
if
(
<=
_Old_size
)
{
(
);
}
else
{
(
-
_Old_size
,
);
}
}
_NODISCARD size_type capacity() const noexcept
{
return
(
this
->
().
);
}
void reserve(_CRT_GUARDOVERFLOW const size_type _Newcap = 0)
void
(
__declspec
(guard(overflow))
const
=
0
)
{
auto
&
=
this
->
();
if
(
_My_data
.
>
)
{
return
;
}
if
(
_My_data
.
)
{
return
;
}
if
(
_My_data
.
)
{
const
=
_My_data
.
;
(
-
_Old_size
,
[](
*
const
,
const
*
const
,
const
) {
::copy(
_New_ptr
,
_Old_ptr
,
_Old_size
+
1
);
});
_My_data
.
=
_Old_size
;
return
;
}
if
(
this
->
>
&&
_My_data
.
())
{
();
return
;
}
}
_NODISCARD bool empty() const noexcept
{
return
(
()
0
);
}
size_type copy(_Out_writes_(_Count) _Elem * const _Ptr,
,
const
=
0
)
const
{
auto
&
=
this
->
();
_My_data
.
(
);
=
_My_data
.
(
,
);
::copy(
,
_My_data
.
() +
,
);
return
(
);
}
_Pre_satisfies_(_Dest_size >= _Count) size_type _Copy_s(
_Out_writes_all_(_Dest_size) _Elem * const _Dest, const size_type _Dest_size,
,
const
=
0
)
const
{
auto
&
=
this
->
();
_My_data
.
(
);
=
_My_data
.
(
,
);
::_Copy_s(
,
,
_My_data
.
() +
,
);
return
(
);
}
void
(
&
,
)
{
const auto _My_data_mem = reinterpret_cast<unsigned char *>(_STD addressof(this->_Get_data()))
const
auto
=
reinterpret_cast
<
unsigned
char
*>(::
std
::
(
this
->
()))
+
;
const auto _Right_data_mem = reinterpret_cast<unsigned char *>(_STD addressof(_Right._Get_data()))
const
auto
=
reinterpret_cast
<
unsigned
char
*>(::
std
::
(
.
()))
+
;
unsigned
char
[
];
_CSTD memcpy(_Temp_mem, _My_data_mem, _Memcpy_move_size);
::
(
_Temp_mem
,
_My_data_mem
,
);
_CSTD memcpy(_My_data_mem, _Right_data_mem, _Memcpy_move_size);
::
(
_My_data_mem
,
_Right_data_mem
,
);
_CSTD memcpy(_Right_data_mem, _Temp_mem, _Memcpy_move_size);
::
(
_Right_data_mem
,
_Temp_mem
,
);
}
void
_Swap_bx_large_with_small
(
&
,
&
)
{
const
=
.
.
;
auto
&
=
this
->
();
_Alty_traits::destroy(_Al, _STD addressof(_Starts_large._Bx._Ptr));
::copy(
.
.
,
.
.
,
this
->
);
_Alty_traits::construct(_Al, _STD addressof(_Starts_small._Bx._Ptr), _Ptr);
::
(
_Al
, ::
std
::
(
.
.
),
_Ptr
);
}
void
(
&
,
)
{
auto
&
=
this
->
();
auto
&
=
.
();
const
bool
=
_My_data
.
();
const
bool
=
_Right_data
.
();
if
(
_My_large
)
{
if
(
_Right_large
)
{
(
_My_data
.
.
,
_Right_data
.
.
);
}
else
{
_Swap_bx_large_with_small
(
_My_data
,
_Right_data
);
}
}
else
{
if
(
_Right_large
)
{
_Swap_bx_large_with_small
(
_Right_data
,
_My_data
);
}
else
{
[
this
->
];
::copy(
_Temp_buf
,
_My_data
.
.
,
this
->
);
::copy(
_My_data
.
.
,
_Right_data
.
.
,
this
->
);
::copy(
_Right_data
.
.
,
_Temp_buf
,
this
->
);
}
}
_STD swap(_My_data._Mysize, _Right_data._Mysize);
::
std
::
(
_My_data
.
,
_Right_data
.
);
_STD swap(_My_data._Myres, _Right_data._Myres);
::
std
::
(
_My_data
.
,
_Right_data
.
);
}
void
(
&
)
noexcept
{
if (this != _STD addressof(_Right))
{
(
this
->
(),
.
());
#if _ITERATOR_DEBUG_LEVEL != 0
auto
&
=
this
->
();
auto
&
=
.
();
const
bool
=
_My_data
.
();
const
bool
=
_Right_data
.
();
if
(!
_My_large
)
{
_My_data
.
();
}
if
(!
_Right_large
)
{
_Right_data
.
();
}
if
(
_My_large
||
_Right_large
)
{
_My_data
.
(
_Right_data
);
}
#endif /* _ITERATOR_DEBUG_LEVEL != 0 */
}
(
,
{});
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD size_type find(const _StringViewIsh& _Right, const size_type _Off = 0) const
{ // look for _Right beginning at or after _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (static_cast<size_type>(
_Traits_find<_Traits>(_My_data._Myptr(), _My_data._Mysize, _Off, _As_view.data(), _As_view.size())));
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type find(const basic_string& _Right, const size_type _Off = 0) const noexcept
(
const
&
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
_Right_data
.
(),
_Right_data
.
)));
}
_NODISCARD size_type find(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off, const size_type _Count)
(
const
*
const
,
const
,
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
)));
}
_NODISCARD size_type find(_In_z_ const _Elem * const _Ptr, const size_type _Off = 0) const noexcept // strengthened
(
const
*
const
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
::length(
))));
}
_NODISCARD size_type find(const _Elem _Ch, const size_type _Off = 0) const noexcept // strengthened
(
const
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
)));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD size_type rfind(const _StringViewIsh& _Right, const size_type _Off = npos) const
{ // look for _Right beginning before _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (static_cast<size_type>(
_Traits_rfind<_Traits>(_My_data._Myptr(), _My_data._Mysize, _Off, _As_view.data(), _As_view.size())));
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type rfind(const basic_string& _Right, const size_type _Off = npos) const noexcept
(
const
&
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
_Right_data
.
(),
_Right_data
.
)));
}
_NODISCARD size_type rfind(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
(
const
*
const
,
const
,
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
)));
}
_NODISCARD size_type rfind(_In_z_ const _Elem * const _Ptr, const size_type _Off = npos)
(
const
*
const
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
::length(
))));
}
_NODISCARD size_type rfind(const _Elem _Ch, const size_type _Off = npos) const noexcept // strengthened
(
const
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
)));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD size_type find_first_of(const _StringViewIsh& _Right, const size_type _Off = 0) const
{ // look for one of _Right at or after _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (static_cast<size_type>(_Traits_find_first_of<_Traits>(_My_data._Myptr(), _My_data._Mysize, _Off,
_As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})));
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type find_first_of(const basic_string& _Right, const size_type _Off = 0) const noexcept
(
const
&
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
_Right_data
.
(),
_Right_data
.
,
<
,
>{})));
}
_NODISCARD size_type find_first_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
(
const
*
const
,
const
,
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
,
<
,
>{})));
}
_NODISCARD size_type find_first_of(_In_z_ const _Elem * const _Ptr, const size_type _Off = 0)
(
const
*
const
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
::length(
),
<
,
>{})));
}
_NODISCARD size_type find_first_of(const _Elem _Ch, const size_type _Off = 0) const noexcept // strengthened
(
const
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
)));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD size_type find_last_of(const _StringViewIsh& _Right, const size_type _Off = npos) const
{ // look for one of _Right before _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (static_cast<size_type>(_Traits_find_last_of<_Traits>(_My_data._Myptr(), _My_data._Mysize, _Off,
_As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})));
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type find_last_of(const basic_string& _Right, size_type _Off = npos) const noexcept
(
const
&
,
=
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
_Right_data
.
(),
_Right_data
.
,
<
,
>{})));
}
_NODISCARD size_type find_last_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
(
const
*
const
,
const
,
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
,
<
,
>{})));
}
_NODISCARD size_type find_last_of(_In_z_ const _Elem * const _Ptr, const size_type _Off = npos)
(
const
*
const
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
::length(
),
<
,
>{})));
}
_NODISCARD size_type find_last_of(const _Elem _Ch, const size_type _Off = npos) const noexcept // strengthened
(
const
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
)));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD size_type find_first_not_of(const _StringViewIsh& _Right, const size_type _Off = 0) const
{ // look for none of _Right at or after _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (static_cast<size_type>(_Traits_find_first_not_of<_Traits>(_My_data._Myptr(), _My_data._Mysize, _Off,
_As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})));
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type find_first_not_of(const basic_string& _Right, const size_type _Off = 0) const noexcept
(
const
&
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
static_cast
<
>(
_Traits_find_first_not_of
<
>(
_My_data
.
(),
_My_data
.
,
,
_Right_data
.
(),
_Right_data
.
,
<
,
>{})));
}
_NODISCARD size_type find_first_not_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
(
const
*
const
,
const
,
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
_Traits_find_first_not_of
<
>(
_My_data
.
(),
_My_data
.
,
,
,
,
<
,
>{})));
}
_NODISCARD size_type find_first_not_of(_In_z_ const _Elem * const _Ptr, size_type _Off = 0) const
(
const
*
const
,
=
0
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
_Traits_find_first_not_of
<
>(
_My_data
.
(),
_My_data
.
,
,
,
::length(
),
<
,
>{})));
}
_NODISCARD size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const noexcept // strengthened
(
const
,
const
=
0
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
)));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD size_type find_last_not_of(const _StringViewIsh& _Right, const size_type _Off = npos) const
{ // look for none of _Right before _Off
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (static_cast<size_type>(_Traits_find_last_not_of<_Traits>(_My_data._Myptr(), _My_data._Mysize, _Off,
_As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})));
}
#endif /* _HAS_CXX17 */
_NODISCARD size_type find_last_not_of(const basic_string& _Right, const size_type _Off = npos) const noexcept
(
const
&
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
_Right_data
.
(),
_Right_data
.
,
<
,
>{})));
}
_NODISCARD size_type find_last_not_of(_In_reads_(_Count) const _Elem * const _Ptr, const size_type _Off,
(
const
*
const
,
const
,
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
,
<
,
>{})));
}
_NODISCARD size_type find_last_not_of(_In_z_ const _Elem * const _Ptr, const size_type _Off = npos) const
(
const
*
const
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
,
::length(
),
<
,
>{})));
}
_NODISCARD size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const noexcept // strengthened
(
const
,
const
=
)
const
noexcept
{
auto
&
=
this
->
();
return
(
static_cast
<
>(
<
>(
_My_data
.
(),
_My_data
.
,
,
)));
}
#if _HAS_CXX17
_NODISCARD bool _Starts_with(const basic_string_view<_Elem, _Traits> _Right) const noexcept
{ // test if this instance starts with _Right
return (basic_string_view<_Elem, _Traits>(*this)._Starts_with(_Right));
}
#endif /* _HAS_CXX17 */
_NODISCARD basic_string substr(const size_type _Off = 0, const size_type _Count = npos) const
(
const
=
0
,
const
=
)
const
{
return
(
(*
this
,
,
,
()));
}
bool
(
const
&
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
<
>(
_My_data
.
(),
_My_data
.
,
_Right_data
.
(),
_Right_data
.
));
}
bool _Equal(_In_z_ const _Elem * const _Ptr) const noexcept
bool
(
const
*
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
<
>(
_My_data
.
(),
_My_data
.
,
,
::length(
)));
}
#if _HAS_CXX17
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD int compare(const _StringViewIsh& _Right) const
{ // compare [0, size()) with _Right
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
return (_Traits_compare<_Traits>(_My_data._Myptr(), _My_data._Mysize,
_As_view.data(), _As_view.size()));
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD int compare(const size_type _Off, const size_type _N0, const _StringViewIsh& _Right) const
{ // compare [_Off, _Off + _N0) with _Right
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
_My_data._Check_offset(_Off);
return (_Traits_compare<_Traits>(_My_data._Myptr() + _Off, _My_data._Clamp_suffix_size(_Off, _N0),
_As_view.data(), _As_view.size()));
}
template<class _StringViewIsh,
class = _Is_string_view_ish<_StringViewIsh>>
_NODISCARD int compare(const size_type _Off, const size_type _N0,
const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) const
{ // compare [_Off, _Off + _N0) with _Right [_Roff, _Roff + _Count)
basic_string_view<_Elem, _Traits> _As_view = _Right;
auto& _My_data = this->_Get_data();
_My_data._Check_offset(_Off);
const auto _With_substr = _As_view.substr(_Roff, _Count);
return (_Traits_compare<_Traits>(_My_data._Myptr() + _Off, _My_data._Clamp_suffix_size(_Off, _N0),
_With_substr.data(), _With_substr.size()));
}
#endif /* _HAS_CXX17 */
_NODISCARD int compare(const basic_string& _Right) const noexcept
int
(
const
&
)
const
noexcept
{
auto
&
=
this
->
();
auto
&
=
.
();
return
(
<
>(
_My_data
.
(),
_My_data
.
,
_Right_data
.
(),
_Right_data
.
));
}
_NODISCARD int compare(size_type _Off, size_type _N0, const basic_string& _Right) const
int
(
,
,
const
&
)
const
{
auto
&
=
this
->
();
_My_data
.
(
);
auto
&
=
.
();
return
(
<
>(
_My_data
.
() +
,
_My_data
.
(
,
),
_Right_data
.
(),
_Right_data
.
));
}
_NODISCARD int compare(const size_type _Off, const size_type _N0, const basic_string& _Right,
int
(
const
,
const
,
const
&
,
const
,
const
=
)
const
{
auto
&
=
this
->
();
auto
&
=
.
();
_My_data
.
(
);
_Right_data
.
(
);
return
(
<
>(
_My_data
.
() +
,
_My_data
.
(
,
),
_Right_data
.
() +
,
_Right_data
.
(
,
)));
}
_NODISCARD int compare(_In_z_ const _Elem * const _Ptr) const noexcept // strengthened
int
(
const
*
const
)
const
noexcept
{
auto
&
=
this
->
();
return
(
<
>(
_My_data
.
(),
_My_data
.
,
,
::length(
)));
}
_NODISCARD int compare(const size_type _Off, const size_type _N0, _In_z_ const _Elem * const _Ptr) const
int
(
const
,
const
,
const
*
const
)
const
{
auto
&
=
this
->
();
_My_data
.
(
);
return
(
<
>(
_My_data
.
() +
,
_My_data
.
(
,
),
,
::length(
)));
}
_NODISCARD int compare(const size_type _Off, const size_type _N0, _In_reads_(_Count) const _Elem * const _Ptr,
int
(
const
,
const
,
const
*
const
,
const
)
const
{
auto
&
=
this
->
();
_My_data
.
(
);
return
(
<
>(
_My_data
.
() +
,
_My_data
.
(
,
),
,
));
}
_NODISCARD allocator_type get_allocator() const noexcept
{
return
(
static_cast
<
>(
this
->
()));
}
(
const
)
const
{
const
=
();
auto
&
=
this
->
();
const
=
|
this
->
;
if
(
_Masked
>
_Max
)
{
return
(
_Max
);
}
const
=
_My_data
.
;
if
(
_Old
>
_Max
-
_Old
/
2
)
{
return
(
_Max
);
}
return
(
(
_Masked
,
_Old
+
_Old
/
2
));
}
template
<
class
,
class
...
>
&
(
const
,
,
...
)
{
if
(
>
())
{
();
}
auto
&
=
this
->
();
const
=
_My_data
.
;
const
=
(
);
auto
&
=
this
->
();
const
=
_Al
.
(
_New_capacity
+
1
);
_My_data
.
();
_My_data
.
=
;
_My_data
.
=
_New_capacity
;
(
(
_New_ptr
),
,
...);
if
(
this
->
<=
_Old_capacity
)
{
_Al
.
(
_My_data
.
.
,
_Old_capacity
+
1
);
_My_data
.
.
=
_New_ptr
;
}
else
{
_Alty_traits::construct(_Al, _STD addressof(_My_data._Bx._Ptr), _New_ptr);
::
(
_Al
, ::
std
::
(
_My_data
.
.
),
_New_ptr
);
}
return
(*
this
);
}
template
<
class
,
class
...
>
&
(
const
,
,
...
)
{
auto
&
=
this
->
();
const
=
_My_data
.
;
if
(
() -
_Old_size
)
{
();
}
const
=
_Old_size
+
;
const
=
_My_data
.
;
const
=
(
_New_size
);
auto
&
=
this
->
();
const
=
_Al
.
(
_New_capacity
+
1
);
_My_data
.
();
_My_data
.
=
_New_size
;
_My_data
.
=
_New_capacity
;
*
const
=
(
_New_ptr
);
if
(
this
->
<=
_Old_capacity
)
{
const
=
_My_data
.
.
;
(
_Raw_new
,
(
_Old_ptr
),
_Old_size
,
...);
_Al
.
(
_Old_ptr
,
_Old_capacity
+
1
);
_My_data
.
.
=
_New_ptr
;
}
else
{
(
_Raw_new
,
_My_data
.
.
,
_Old_size
,
...);
_Alty_traits::construct(_Al, _STD addressof(_My_data._Bx._Ptr), _New_ptr);
::
(
_Al
, ::
std
::
(
_My_data
.
.
),
_New_ptr
);
}
return
(*
this
);
}
void
()
{
auto
&
=
this
->
();
_My_data
.
();
const
=
_My_data
.
.
;
auto
&
=
this
->
();
_Alty_traits::destroy(_Al, _STD addressof(_My_data._Bx._Ptr));
::
(
_Al
, ::
std
::
(
_My_data
.
.
));
::copy(
_My_data
.
.
,
(
_Ptr
),
_My_data
.
+
1
);
_Al
.
(
_Ptr
,
_My_data
.
+
1
);
_My_data
.
=
this
->
-
1
;
}
void
(
const
)
{
auto
&
=
this
->
();
::assign(
_My_data
.
()[
_My_data
.
=
],
());
}
void
()
{
auto
&
=
this
->
();
_My_data
.
=
0
;
_My_data
.
=
this
->
-
1
;
::assign(
_My_data
.
.
[
0
],
());
}
void
()
{
this
->
();
auto
&
=
this
->
();
if
(
_My_data
.
())
{
const
=
_My_data
.
.
;
auto
&
=
this
->
();
_Alty_traits::destroy(_Al, _STD addressof(_My_data._Bx._Ptr));
::
(
_Al
, ::
std
::
(
_My_data
.
.
));
_Al
.
(
_Ptr
,
_My_data
.
+
1
);
}
_My_data
.
=
0
;
_My_data
.
=
this
->
-
1
;
::assign(
_My_data
.
.
[
0
],
());
}
[[noreturn]]
static
void
()
{
(
"string too long"
);
}
};
#if _HAS_CXX17
template<class _Iter,
class _Alloc = allocator<_Iter_value_t<_Iter>>,
enable_if_t<conjunction_v<
_Is_iterator<_Iter>,
_Is_allocator<_Alloc>
>, int> = 0>
basic_string(_Iter, _Iter, _Alloc = _Alloc())
-> basic_string<_Iter_value_t<_Iter>, char_traits<_Iter_value_t<_Iter>>, _Alloc>;
template<class _Elem,
class _Traits,
class _Alloc = allocator<_Elem>,
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
explicit basic_string(basic_string_view<_Elem, _Traits>, const _Alloc& = _Alloc())
-> basic_string<_Elem, _Traits, _Alloc>;
template<class _Elem,
class _Traits,
class _Alloc = allocator<_Elem>,
enable_if_t<_Is_allocator<_Alloc>::value, int> = 0>
basic_string(basic_string_view<_Elem, _Traits>, _Guide_size_type_t<_Alloc>, _Guide_size_type_t<_Alloc>,
const _Alloc& = _Alloc())
-> basic_string<_Elem, _Traits, _Alloc>;
#endif /* _HAS_CXX17 */
template
<
class
,
class
,
class
>
inline
void
(
<
,
,
>&
,
<
,
,
>&
)
noexcept
{
.
(
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
const
<
,
,
>&
,
const
<
,
,
>&
)
{
<
,
,
>
;
_Ans
.
(
.
() +
.
());
_Ans
;
_Ans
;
return
(
_Ans
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
using
=
<
,
,
>;
using
=
typename
::
;
;
_Ans
.
(
<
>(
::length(
) +
.
()));
_Ans
;
_Ans
;
return
(
_Ans
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
const
,
const
<
,
,
>&
)
{
<
,
,
>
;
_Ans
.
(
1
+
.
());
_Ans
+=
;
_Ans
;
return
(
_Ans
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
using
=
<
,
,
>;
using
=
typename
::
;
;
_Ans
.
(
<
>(
.
() +
::length(
)));
_Ans
;
_Ans
;
return
(
_Ans
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
const
<
,
,
>&
,
const
)
{
<
,
,
>
;
_Ans
.
(
.
() +
1
);
_Ans
;
_Ans
+=
;
return
(
_Ans
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
const
<
,
,
>&
,
<
,
,
>&&
)
{
return (_STD move(_Right.insert(0, _Left)));
return
(::
std
::
(
.
(
0
,
)));
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
<
,
,
>&&
,
const
<
,
,
>&
)
{
return (_STD move(_Left.append(_Right)));
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
<
,
,
>&&
,
<
,
,
>&&
)
{
if
(
.
() <=
.
() -
.
()
||
.
() -
.
()
.
())
return (_STD move(_Left.append(_Right)));
else
return (_STD move(_Right.insert(0, _Left)));
return
(::
std
::
(
.
(
0
,
)));
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
_In_z_ const _Elem * const _Left,
<
,
,
>&&
)
{
return (_STD move(_Right.insert(0, _Left)));
return
(::
std
::
(
.
(
0
,
)));
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
const
,
<
,
,
>&&
)
{
using
=
typename
<
>::
;
return (_STD move(_Right.insert(static_cast<size_type>(0), static_cast<size_type>(1), _Left)));
return
(::
std
::
(
.
(
static_cast
<
>(
0
),
static_cast
<
>(
1
),
)));
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
<
,
,
>&&
,
_In_z_ const _Elem * const _Right)
{
return (_STD move(_Left.append(_Right)));
}
template
<
class
,
class
,
class
>
_NODISCARD inline basic_string<_Elem, _Traits, _Alloc> operator+(
<
,
,
>&&
,
const
)
{
.
(
);
return (_STD move(_Left));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator==(
const
<
,
,
>&
,
const
<
,
,
>&
)
noexcept
{
return
(
.
(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator==(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
return
(
.
(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator==(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
return
(
.
(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator!=(
const
<
,
,
>&
,
const
<
,
,
>&
)
noexcept
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator!=(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator!=(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator<(
const
<
,
,
>&
,
const
<
,
,
>&
)
noexcept
{
return
(
.
(
)
0
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator<(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
return
(
.
(
) >
0
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator<(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
return
(
.
(
)
0
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator>(
const
<
,
,
>&
,
const
<
,
,
>&
)
noexcept
{
return
(
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator>(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
return
(
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator>(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
return
(
);
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator<=(
const
<
,
,
>&
,
const
<
,
,
>&
)
noexcept
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator<=(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator<=(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator>=(
const
<
,
,
>&
,
const
<
,
,
>&
)
noexcept
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator>=(
_In_z_ const _Elem * const _Left,
const
<
,
,
>&
)
{
return
(!(
));
}
template
<
class
,
class
,
class
>
_NODISCARD inline bool operator>=(
const
<
,
,
>&
,
_In_z_ const _Elem * const _Right)
{
return
(!(
));
}
using
=
<
char
,
<
char
>,
<
char
>>;
using
=
<
wchar_t
,
<
wchar_t
>,
<
wchar_t
>>;
using
=
<
char16_t
,
<
char16_t
>,
<
char16_t
>>;
using
=
<
char32_t
,
<
char32_t
>,
<
char32_t
>>;
template
<
class
,
class
,
class
>
struct
<
<
,
,
>>
{
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef basic_string<_Elem, _Traits, _Alloc> argument_type;
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t result_type;
_NODISCARD size_t operator()(const basic_string<_Elem, _Traits, _Alloc>& _Keyval) const noexcept
(
const
<
,
,
>&
)
const
noexcept
{
return
(
_Hash_array_representation
(
.
(),
.
()));
}
};
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _XSTRING_ */