Merge to upstream r222492.
Change-Id: I6a0a6e90d217a69531ec3bb5ca0a367f39f4a1da
This commit is contained in:
248
include/string
248
include/string
@@ -453,6 +453,8 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@@ -507,14 +509,11 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
|
||||
typedef streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -524,20 +523,15 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(EOF);}
|
||||
};
|
||||
|
||||
@@ -634,51 +628,37 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char>
|
||||
typedef streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return (unsigned char)__c1 < (unsigned char)__c2;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return memcmp(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static size_t length(const char_type* __s) {return strlen(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
static inline size_t length(const char_type* __s) {return strlen(__s);}
|
||||
static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
{return (const char_type*)memchr(__s, to_int_type(__a), __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return (char_type*)memmove(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return (char_type*)memcpy(__s1, __s2, __n);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)memset(__s, to_int_type(__a), __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type((unsigned char)__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(EOF);}
|
||||
};
|
||||
|
||||
@@ -693,52 +673,38 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t>
|
||||
typedef streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return wmemcmp(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static size_t length(const char_type* __s)
|
||||
static inline size_t length(const char_type* __s)
|
||||
{return wcslen(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
{return (const char_type*)wmemchr(__s, __a, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return (char_type*)wmemmove(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return (char_type*)wmemcpy(__s1, __s2, __n);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)wmemset(__s, __a, __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(WEOF);}
|
||||
};
|
||||
|
||||
@@ -753,14 +719,11 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
|
||||
typedef u16streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -770,20 +733,15 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(0xDFFF);}
|
||||
};
|
||||
|
||||
@@ -874,14 +832,11 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
|
||||
typedef u32streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -891,20 +846,15 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(0xFFFFFFFF);}
|
||||
};
|
||||
|
||||
@@ -990,10 +940,10 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
|
||||
|
||||
// helper fns for basic_string
|
||||
|
||||
// __find
|
||||
// __str_find
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find(const _CharT *__p, _SizeT __sz,
|
||||
__str_find(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__pos >= __sz)
|
||||
@@ -1006,28 +956,28 @@ __find(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find(const _CharT *__p, _SizeT __sz,
|
||||
__str_find(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos > __sz || __sz - __pos < __n)
|
||||
return __npos;
|
||||
if (__n == 0)
|
||||
return __pos;
|
||||
// if (__n == 1)
|
||||
// return _VSTD::__find<_CharT, _SizeT, _Traits, __npos>(__p, __sz, *__s, __pos);
|
||||
const _CharT* __r =
|
||||
_VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq);
|
||||
_VSTD::__search(__p + __pos, __p + __sz,
|
||||
__s, __s + __n, _Traits::eq,
|
||||
random_access_iterator_tag(), random_access_iterator_tag());
|
||||
if (__r == __p + __sz)
|
||||
return __npos;
|
||||
return static_cast<_SizeT>(__r - __p);
|
||||
}
|
||||
|
||||
|
||||
// __rfind
|
||||
// __str_rfind
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__rfind(const _CharT *__p, _SizeT __sz,
|
||||
__str_rfind(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__sz < 1)
|
||||
@@ -1046,7 +996,7 @@ __rfind(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__rfind(const _CharT *__p, _SizeT __sz,
|
||||
__str_rfind(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
__pos = _VSTD::min(__pos, __sz);
|
||||
@@ -1054,21 +1004,23 @@ __rfind(const _CharT *__p, _SizeT __sz,
|
||||
__pos += __n;
|
||||
else
|
||||
__pos = __sz;
|
||||
const _CharT* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, _Traits::eq);
|
||||
const _CharT* __r = _VSTD::__find_end(
|
||||
__p, __p + __pos, __s, __s + __n, _Traits::eq,
|
||||
random_access_iterator_tag(), random_access_iterator_tag());
|
||||
if (__n > 0 && __r == __p + __pos)
|
||||
return __npos;
|
||||
return static_cast<_SizeT>(__r - __p);
|
||||
}
|
||||
|
||||
// __find_first_of
|
||||
// __str_find_first_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_first_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_first_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos >= __sz || __n == 0)
|
||||
return __npos;
|
||||
const _CharT* __r = _VSTD::find_first_of
|
||||
const _CharT* __r = _VSTD::__find_first_of_ce
|
||||
(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
|
||||
if (__r == __p + __sz)
|
||||
return __npos;
|
||||
@@ -1076,10 +1028,10 @@ __find_first_of(const _CharT *__p, _SizeT __sz,
|
||||
}
|
||||
|
||||
|
||||
// __find_last_of
|
||||
// __str_find_last_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_last_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_last_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__n != 0)
|
||||
@@ -1099,10 +1051,10 @@ __find_last_of(const _CharT *__p, _SizeT __sz,
|
||||
}
|
||||
|
||||
|
||||
// __find_first_not_of
|
||||
// __str_find_first_not_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -1118,7 +1070,7 @@ __find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -1132,10 +1084,10 @@ __find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
}
|
||||
|
||||
|
||||
// __find_last_not_of
|
||||
// __str_find_last_not_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -1151,7 +1103,7 @@ __find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -2263,7 +2215,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
}
|
||||
for (; __first != __last; ++__first, ++__p)
|
||||
for (; __first != __last; ++__first, (void) ++__p)
|
||||
traits_type::assign(*__p, *__first);
|
||||
traits_type::assign(*__p, value_type());
|
||||
}
|
||||
@@ -3429,7 +3381,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3439,7 +3391,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3450,7 +3402,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr");
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3459,7 +3411,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
@@ -3472,7 +3424,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3482,7 +3434,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3493,7 +3445,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr");
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3502,7 +3454,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
@@ -3515,7 +3467,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
|
||||
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3525,7 +3477,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3536,7 +3488,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr");
|
||||
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3558,7 +3510,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
|
||||
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3568,7 +3520,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3579,7 +3531,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr");
|
||||
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3601,7 +3553,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3611,7 +3563,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3622,7 +3574,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3632,7 +3584,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
@@ -3645,7 +3597,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3655,7 +3607,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3666,7 +3618,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3676,7 +3628,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user