Implement full support for non-pointer pointers in custom allocators for string. This completes the custom pointer support for the entire library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
328
include/string
328
include/string
@@ -100,8 +100,8 @@ public:
|
||||
noexcept(is_nothrow_move_constructible<allocator_type>::value);
|
||||
basic_string(const basic_string& str, size_type pos, size_type n = npos,
|
||||
const allocator_type& a = allocator_type());
|
||||
basic_string(const_pointer s, const allocator_type& a = allocator_type());
|
||||
basic_string(const_pointer s, size_type n, const allocator_type& a = allocator_type());
|
||||
basic_string(const value_type* s, const allocator_type& a = allocator_type());
|
||||
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
|
||||
basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
|
||||
template<class InputIterator>
|
||||
basic_string(InputIterator begin, InputIterator end,
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
basic_string& operator=(const_pointer s);
|
||||
basic_string& operator=(const value_type* s);
|
||||
basic_string& operator=(value_type c);
|
||||
basic_string& operator=(initializer_list<value_type>);
|
||||
|
||||
@@ -156,14 +156,14 @@ public:
|
||||
reference at(size_type n);
|
||||
|
||||
basic_string& operator+=(const basic_string& str);
|
||||
basic_string& operator+=(const_pointer s);
|
||||
basic_string& operator+=(const value_type* s);
|
||||
basic_string& operator+=(value_type c);
|
||||
basic_string& operator+=(initializer_list<value_type>);
|
||||
|
||||
basic_string& append(const basic_string& str);
|
||||
basic_string& append(const basic_string& str, size_type pos, size_type n);
|
||||
basic_string& append(const_pointer s, size_type n);
|
||||
basic_string& append(const_pointer s);
|
||||
basic_string& append(const value_type* s, size_type n);
|
||||
basic_string& append(const value_type* s);
|
||||
basic_string& append(size_type n, value_type c);
|
||||
template<class InputIterator>
|
||||
basic_string& append(InputIterator first, InputIterator last);
|
||||
@@ -179,8 +179,8 @@ public:
|
||||
basic_string& assign(const basic_string& str);
|
||||
basic_string& assign(basic_string&& str);
|
||||
basic_string& assign(const basic_string& str, size_type pos, size_type n);
|
||||
basic_string& assign(const_pointer s, size_type n);
|
||||
basic_string& assign(const_pointer s);
|
||||
basic_string& assign(const value_type* s, size_type n);
|
||||
basic_string& assign(const value_type* s);
|
||||
basic_string& assign(size_type n, value_type c);
|
||||
template<class InputIterator>
|
||||
basic_string& assign(InputIterator first, InputIterator last);
|
||||
@@ -189,8 +189,8 @@ public:
|
||||
basic_string& insert(size_type pos1, const basic_string& str);
|
||||
basic_string& insert(size_type pos1, const basic_string& str,
|
||||
size_type pos2, size_type n);
|
||||
basic_string& insert(size_type pos, const_pointer s, size_type n);
|
||||
basic_string& insert(size_type pos, const_pointer s);
|
||||
basic_string& insert(size_type pos, const value_type* s, size_type n);
|
||||
basic_string& insert(size_type pos, const value_type* s);
|
||||
basic_string& insert(size_type pos, size_type n, value_type c);
|
||||
iterator insert(const_iterator p, value_type c);
|
||||
iterator insert(const_iterator p, size_type n, value_type c);
|
||||
@@ -205,66 +205,66 @@ public:
|
||||
basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
|
||||
basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
|
||||
size_type pos2, size_type n2);
|
||||
basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2);
|
||||
basic_string& replace(size_type pos, size_type n1, const_pointer s);
|
||||
basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2);
|
||||
basic_string& replace(size_type pos, size_type n1, const value_type* s);
|
||||
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
|
||||
template<class InputIterator>
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
|
||||
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
|
||||
|
||||
size_type copy(pointer s, size_type n, size_type pos = 0) const;
|
||||
size_type copy(value_type* s, size_type n, size_type pos = 0) const;
|
||||
basic_string substr(size_type pos = 0, size_type n = npos) const;
|
||||
|
||||
void swap(basic_string& str)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
|
||||
const_pointer c_str() const noexcept;
|
||||
const_pointer data() const noexcept;
|
||||
const value_type* c_str() const noexcept;
|
||||
const value_type* data() const noexcept;
|
||||
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
size_type find(const basic_string& str, size_type pos = 0) const noexcept;
|
||||
size_type find(const_pointer s, size_type pos, size_type n) const noexcept;
|
||||
size_type find(const_pointer s, size_type pos = 0) const noexcept;
|
||||
size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||
size_type find(const value_type* s, size_type pos = 0) const noexcept;
|
||||
size_type find(value_type c, size_type pos = 0) const noexcept;
|
||||
|
||||
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
|
||||
size_type rfind(const_pointer s, size_type pos, size_type n) const noexcept;
|
||||
size_type rfind(const_pointer s, size_type pos = npos) const noexcept;
|
||||
size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||
size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
|
||||
size_type rfind(value_type c, size_type pos = npos) const noexcept;
|
||||
|
||||
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
|
||||
size_type find_first_of(const_pointer s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_first_of(const_pointer s, size_type pos = 0) const noexcept;
|
||||
size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
|
||||
size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
|
||||
|
||||
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
|
||||
size_type find_last_of(const_pointer s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_last_of(const_pointer s, size_type pos = npos) const noexcept;
|
||||
size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
|
||||
size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
|
||||
|
||||
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
|
||||
size_type find_first_not_of(const_pointer s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_first_not_of(const_pointer s, size_type pos = 0) const noexcept;
|
||||
size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
|
||||
size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
|
||||
|
||||
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
|
||||
size_type find_last_not_of(const_pointer s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_last_not_of(const_pointer s, size_type pos = npos) const noexcept;
|
||||
size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||
size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
|
||||
size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
|
||||
|
||||
int compare(const basic_string& str) const noexcept;
|
||||
int compare(size_type pos1, size_type n1, const basic_string& str) const;
|
||||
int compare(size_type pos1, size_type n1, const basic_string& str,
|
||||
size_type pos2, size_type n2) const;
|
||||
int compare(const_pointer s) const noexcept;
|
||||
int compare(size_type pos1, size_type n1, const_pointer s) const;
|
||||
int compare(size_type pos1, size_type n1, const_pointer s, size_type n2) const;
|
||||
int compare(const value_type* s) const noexcept;
|
||||
int compare(size_type pos1, size_type n1, const value_type* s) const;
|
||||
int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const;
|
||||
|
||||
bool __invariants() const;
|
||||
};
|
||||
@@ -1192,13 +1192,13 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(basic_string&& __str, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s);
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const_pointer __s, const allocator_type& __a);
|
||||
basic_string(const value_type* __s, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const_pointer __s, size_type __n);
|
||||
basic_string(const value_type* __s, size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const_pointer __s, size_type __n, const allocator_type& __a);
|
||||
basic_string(const value_type* __s, size_type __n, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(size_type __n, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1227,7 +1227,7 @@ public:
|
||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
|
||||
basic_string& operator=(value_type __c);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1240,13 +1240,13 @@ public:
|
||||
{return iterator(__get_pointer());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT
|
||||
{return const_iterator(data());}
|
||||
{return const_iterator(__get_pointer());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT
|
||||
{return iterator(__get_pointer() + size());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT
|
||||
{return const_iterator(data() + size());}
|
||||
{return const_iterator(__get_pointer() + size());}
|
||||
#else // _LIBCPP_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(this, __get_pointer());}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(this, data());}
|
||||
@@ -1303,7 +1303,7 @@ public:
|
||||
reference at(size_type __n);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const_pointer __s) {return append(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
|
||||
@@ -1312,8 +1312,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& append(const basic_string& __str);
|
||||
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
|
||||
basic_string& append(const_pointer __s, size_type __n);
|
||||
basic_string& append(const_pointer __s);
|
||||
basic_string& append(const value_type* __s, size_type __n);
|
||||
basic_string& append(const value_type* __s);
|
||||
basic_string& append(size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
@@ -1351,8 +1351,8 @@ public:
|
||||
{*this = _VSTD::move(str); return *this;}
|
||||
#endif
|
||||
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
|
||||
basic_string& assign(const_pointer __s, size_type __n);
|
||||
basic_string& assign(const_pointer __s);
|
||||
basic_string& assign(const value_type* __s, size_type __n);
|
||||
basic_string& assign(const value_type* __s);
|
||||
basic_string& assign(size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
@@ -1377,8 +1377,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& insert(size_type __pos1, const basic_string& __str);
|
||||
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
|
||||
basic_string& insert(size_type __pos, const_pointer __s, size_type __n);
|
||||
basic_string& insert(size_type __pos, const_pointer __s);
|
||||
basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
|
||||
basic_string& insert(size_type __pos, const value_type* __s);
|
||||
basic_string& insert(size_type __pos, size_type __n, value_type __c);
|
||||
iterator insert(const_iterator __pos, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1413,15 +1413,15 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
|
||||
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
|
||||
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
|
||||
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
|
||||
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
|
||||
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
|
||||
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
@@ -1437,7 +1437,7 @@ public:
|
||||
{return replace(__i1, __i2, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
|
||||
size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
|
||||
|
||||
@@ -1447,56 +1447,56 @@ public:
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_pointer c_str() const _NOEXCEPT {return data();}
|
||||
const value_type* c_str() const _NOEXCEPT {return data();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_pointer data() const _NOEXCEPT {return __get_pointer();}
|
||||
const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const_pointer __s, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type rfind(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const_pointer __s, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const_pointer __s, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const_pointer __s, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const _NOEXCEPT;
|
||||
size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const _NOEXCEPT;
|
||||
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
|
||||
|
||||
@@ -1505,9 +1505,9 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
|
||||
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
|
||||
int compare(const_pointer __s) const _NOEXCEPT;
|
||||
int compare(size_type __pos1, size_type __n1, const_pointer __s) const;
|
||||
int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
|
||||
int compare(const value_type* __s) const _NOEXCEPT;
|
||||
int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
|
||||
int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY bool __invariants() const;
|
||||
|
||||
@@ -1589,10 +1589,10 @@ private:
|
||||
{return __r_.first().__l.__data_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer __get_short_pointer() _NOEXCEPT
|
||||
{return __r_.first().__s.__data_;}
|
||||
{return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_pointer __get_short_pointer() const _NOEXCEPT
|
||||
{return __r_.first().__s.__data_;}
|
||||
{return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer __get_pointer() _NOEXCEPT
|
||||
{return __is_long() ? __get_long_pointer() : __get_short_pointer();}
|
||||
@@ -1619,8 +1619,8 @@ private:
|
||||
__align<sizeof(value_type) < __alignment ?
|
||||
__alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
|
||||
|
||||
void __init(const_pointer __s, size_type __sz, size_type __reserve);
|
||||
void __init(const_pointer __s, size_type __sz);
|
||||
void __init(const value_type* __s, size_type __sz, size_type __reserve);
|
||||
void __init(const value_type* __s, size_type __sz);
|
||||
void __init(size_type __n, value_type __c);
|
||||
|
||||
template <class _InputIterator>
|
||||
@@ -1644,7 +1644,7 @@ private:
|
||||
size_type __n_copy, size_type __n_del, size_type __n_add = 0);
|
||||
void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
|
||||
size_type __n_copy, size_type __n_del,
|
||||
size_type __n_add, const_pointer __p_new_stuff);
|
||||
size_type __n_add, const value_type* __p_new_stuff);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __erase_to_end(size_type __pos);
|
||||
@@ -1801,7 +1801,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type __sz, size_type __reserve)
|
||||
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve)
|
||||
{
|
||||
if (__reserve > max_size())
|
||||
this->__throw_length_error();
|
||||
@@ -1819,13 +1819,13 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
}
|
||||
traits_type::copy(__p, __s, __sz);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
|
||||
traits_type::assign(__p[__sz], value_type());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type __sz)
|
||||
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
|
||||
{
|
||||
if (__sz > max_size())
|
||||
this->__throw_length_error();
|
||||
@@ -1843,13 +1843,13 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
}
|
||||
traits_type::copy(__p, __s, __sz);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
|
||||
traits_type::assign(__p[__sz], value_type());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -1859,7 +1859,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s)
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, const allocator_type& __a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -1870,7 +1870,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, const
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -1880,7 +1880,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_type __n, const allocator_type& __a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -1896,7 +1896,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
else
|
||||
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
||||
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -1906,7 +1906,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
else
|
||||
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
||||
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1931,7 +1931,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
|
||||
if (__a == __str.__alloc() || !__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
else
|
||||
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
||||
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
__str.__zero();
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
__str.__invalidate_all_iterators();
|
||||
@@ -1960,7 +1960,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__n);
|
||||
}
|
||||
traits_type::assign(__p, __n, __c);
|
||||
traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c);
|
||||
traits_type::assign(__p[__n], value_type());
|
||||
}
|
||||
|
||||
@@ -2098,7 +2098,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
||||
(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
|
||||
size_type __n_copy, size_type __n_del, size_type __n_add, const_pointer __p_new_stuff)
|
||||
size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff)
|
||||
{
|
||||
size_type __ms = max_size();
|
||||
if (__delta_cap > __ms - __old_cap - 1)
|
||||
@@ -2110,12 +2110,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
||||
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__invalidate_all_iterators();
|
||||
if (__n_copy != 0)
|
||||
traits_type::copy(__p, __old_p, __n_copy);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p),
|
||||
_VSTD::__to_raw_pointer(__old_p), __n_copy);
|
||||
if (__n_add != 0)
|
||||
traits_type::copy(__p + __n_copy, __p_new_stuff, __n_add);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add);
|
||||
size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
|
||||
if (__sec_cp_sz != 0)
|
||||
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
|
||||
_VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz);
|
||||
if (__old_cap+1 != __min_cap)
|
||||
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
|
||||
__set_long_pointer(__p);
|
||||
@@ -2140,10 +2142,13 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
||||
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
|
||||
__invalidate_all_iterators();
|
||||
if (__n_copy != 0)
|
||||
traits_type::copy(__p, __old_p, __n_copy);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p),
|
||||
_VSTD::__to_raw_pointer(__old_p), __n_copy);
|
||||
size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
|
||||
if (__sec_cp_sz != 0)
|
||||
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
|
||||
_VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del,
|
||||
__sec_cp_sz);
|
||||
if (__old_cap+1 != __min_cap)
|
||||
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
|
||||
__set_long_pointer(__p);
|
||||
@@ -2154,7 +2159,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2162,7 +2167,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s, size_type _
|
||||
size_type __cap = capacity();
|
||||
if (__cap >= __n)
|
||||
{
|
||||
pointer __p = __get_pointer();
|
||||
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
traits_type::move(__p, __s, __n);
|
||||
traits_type::assign(__p[__n], value_type());
|
||||
__set_size(__n);
|
||||
@@ -2188,7 +2193,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
|
||||
}
|
||||
else
|
||||
__invalidate_iterators_past(__n);
|
||||
pointer __p = __get_pointer();
|
||||
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
traits_type::assign(__p, __n, __c);
|
||||
traits_type::assign(__p[__n], value_type());
|
||||
__set_size(__n);
|
||||
@@ -2330,7 +2335,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2342,7 +2347,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s)
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2353,7 +2358,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s, size_type _
|
||||
{
|
||||
if (__n)
|
||||
{
|
||||
pointer __p = __get_pointer();
|
||||
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
traits_type::copy(__p + __sz, __s, __n);
|
||||
__sz += __n;
|
||||
__set_size(__sz);
|
||||
@@ -2376,7 +2381,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
|
||||
if (__cap - __sz < __n)
|
||||
__grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
|
||||
pointer __p = __get_pointer();
|
||||
traits_type::assign(__p + __sz, __n, __c);
|
||||
traits_type::assign(_VSTD::__to_raw_pointer(__p) + __sz, __n, __c);
|
||||
__sz += __n;
|
||||
__set_size(__sz);
|
||||
traits_type::assign(__p[__sz], value_type());
|
||||
@@ -2481,7 +2486,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2493,7 +2498,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s)
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2506,7 +2511,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer
|
||||
{
|
||||
if (__n)
|
||||
{
|
||||
pointer __p = __get_pointer();
|
||||
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
size_type __n_move = __sz - __pos;
|
||||
if (__n_move != 0)
|
||||
{
|
||||
@@ -2535,10 +2540,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
|
||||
if (__n)
|
||||
{
|
||||
size_type __cap = capacity();
|
||||
pointer __p;
|
||||
value_type* __p;
|
||||
if (__cap - __sz >= __n)
|
||||
{
|
||||
__p = __get_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
size_type __n_move = __sz - __pos;
|
||||
if (__n_move != 0)
|
||||
traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
|
||||
@@ -2546,7 +2551,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
|
||||
else
|
||||
{
|
||||
__grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
|
||||
__p = __get_long_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
||||
}
|
||||
traits_type::assign(__p + __pos, __n, __c);
|
||||
__sz += __n;
|
||||
@@ -2590,10 +2595,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
|
||||
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
if (__n)
|
||||
{
|
||||
pointer __p;
|
||||
value_type* __p;
|
||||
if (__cap - __sz >= __n)
|
||||
{
|
||||
__p = __get_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
size_type __n_move = __sz - __ip;
|
||||
if (__n_move != 0)
|
||||
traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
|
||||
@@ -2601,7 +2606,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
|
||||
else
|
||||
{
|
||||
__grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
|
||||
__p = __get_long_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
||||
}
|
||||
__sz += __n;
|
||||
__set_size(__sz);
|
||||
@@ -2633,7 +2638,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2648,15 +2653,15 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty
|
||||
size_type __ip = static_cast<size_type>(__pos - begin());
|
||||
size_type __sz = size();
|
||||
size_type __cap = capacity();
|
||||
pointer __p;
|
||||
value_type* __p;
|
||||
if (__cap == __sz)
|
||||
{
|
||||
__grow_by(__cap, 1, __sz, __ip, 0, 1);
|
||||
__p = __get_long_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
||||
}
|
||||
else
|
||||
{
|
||||
__p = __get_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
size_type __n_move = __sz - __ip;
|
||||
if (__n_move != 0)
|
||||
traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
|
||||
@@ -2681,7 +2686,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2693,7 +2698,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
||||
size_type __cap = capacity();
|
||||
if (__cap - __sz + __n1 >= __n2)
|
||||
{
|
||||
pointer __p = __get_pointer();
|
||||
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
if (__n1 != __n2)
|
||||
{
|
||||
size_type __n_move = __sz - __pos - __n1;
|
||||
@@ -2742,10 +2747,10 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
||||
this->__throw_out_of_range();
|
||||
__n1 = _VSTD::min(__n1, __sz - __pos);
|
||||
size_type __cap = capacity();
|
||||
pointer __p;
|
||||
value_type* __p;
|
||||
if (__cap - __sz + __n1 >= __n2)
|
||||
{
|
||||
__p = __get_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
if (__n1 != __n2)
|
||||
{
|
||||
size_type __n_move = __sz - __pos - __n1;
|
||||
@@ -2756,7 +2761,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
||||
else
|
||||
{
|
||||
__grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
|
||||
__p = __get_long_pointer();
|
||||
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
||||
}
|
||||
traits_type::assign(__p + __pos, __n2, __c);
|
||||
__sz += __n2 - __n1;
|
||||
@@ -2815,7 +2820,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -2835,7 +2840,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n)
|
||||
{
|
||||
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
|
||||
}
|
||||
@@ -2843,7 +2848,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s)
|
||||
{
|
||||
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
|
||||
}
|
||||
@@ -2867,7 +2872,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)
|
||||
this->__throw_out_of_range();
|
||||
if (__n)
|
||||
{
|
||||
pointer __p = __get_pointer();
|
||||
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
||||
__n = _VSTD::min(__n, __sz - __pos);
|
||||
size_type __n_move = __sz - __pos - __n;
|
||||
if (__n_move != 0)
|
||||
@@ -3025,7 +3030,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
return;
|
||||
}
|
||||
#else // _LIBCPP_NO_EXCEPTIONS
|
||||
if (__new_data == 0)
|
||||
if (__new_data == nullptr)
|
||||
return;
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -3033,7 +3038,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
__was_long = __is_long();
|
||||
__p = __get_pointer();
|
||||
}
|
||||
traits_type::copy(__new_data, __p, size()+1);
|
||||
traits_type::copy(_VSTD::__to_raw_pointer(__new_data),
|
||||
_VSTD::__to_raw_pointer(__p), size()+1);
|
||||
if (__was_long)
|
||||
__alloc_traits::deallocate(__alloc(), __p, __cap+1);
|
||||
if (__now_long)
|
||||
@@ -3134,7 +3140,7 @@ basic_string<_CharT, _Traits, _Allocator>::back() const
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::copy(pointer __s, size_type __n, size_type __pos) const
|
||||
basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
|
||||
{
|
||||
size_type __sz = size();
|
||||
if (__pos > __sz)
|
||||
@@ -3180,7 +3186,7 @@ struct _LIBCPP_HIDDEN __traits_eq
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
||||
size_type __pos,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
@@ -3192,8 +3198,8 @@ basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s,
|
||||
return npos;
|
||||
if (__n == 0)
|
||||
return __pos;
|
||||
const_pointer __p = data();
|
||||
const_pointer __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n,
|
||||
const value_type* __p = data();
|
||||
const value_type* __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n,
|
||||
__traits_eq<traits_type>());
|
||||
if (__r == __p + __sz)
|
||||
return npos;
|
||||
@@ -3212,7 +3218,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -3229,8 +3235,8 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
|
||||
size_type __sz = size();
|
||||
if (__pos >= __sz)
|
||||
return npos;
|
||||
const_pointer __p = data();
|
||||
const_pointer __r = traits_type::find(__p + __pos, __sz - __pos, __c);
|
||||
const value_type* __p = data();
|
||||
const value_type* __r = traits_type::find(__p + __pos, __sz - __pos, __c);
|
||||
if (__r == 0)
|
||||
return npos;
|
||||
return static_cast<size_type>(__r - __p);
|
||||
@@ -3240,7 +3246,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
||||
size_type __pos,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
@@ -3253,8 +3259,8 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s,
|
||||
__pos += __n;
|
||||
else
|
||||
__pos = __sz;
|
||||
const_pointer __p = data();
|
||||
const_pointer __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n,
|
||||
const value_type* __p = data();
|
||||
const value_type* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n,
|
||||
__traits_eq<traits_type>());
|
||||
if (__n > 0 && __r == __p + __pos)
|
||||
return npos;
|
||||
@@ -3273,7 +3279,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -3294,8 +3300,8 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
|
||||
++__pos;
|
||||
else
|
||||
__pos = __sz;
|
||||
const_pointer __p = data();
|
||||
for (const_pointer __ps = __p + __pos; __ps != __p;)
|
||||
const value_type* __p = data();
|
||||
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
||||
{
|
||||
if (traits_type::eq(*--__ps, __c))
|
||||
return static_cast<size_type>(__ps - __p);
|
||||
@@ -3308,7 +3314,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
||||
size_type __pos,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
@@ -3318,8 +3324,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s,
|
||||
size_type __sz = size();
|
||||
if (__pos >= __sz || __n == 0)
|
||||
return npos;
|
||||
const_pointer __p = data();
|
||||
const_pointer __r = _VSTD::find_first_of(__p + __pos, __p + __sz, __s,
|
||||
const value_type* __p = data();
|
||||
const value_type* __r = _VSTD::find_first_of(__p + __pos, __p + __sz, __s,
|
||||
__s + __n, __traits_eq<traits_type>());
|
||||
if (__r == __p + __sz)
|
||||
return npos;
|
||||
@@ -3338,7 +3344,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __s
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -3360,7 +3366,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
||||
size_type __pos,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
@@ -3374,10 +3380,10 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s,
|
||||
++__pos;
|
||||
else
|
||||
__pos = __sz;
|
||||
const_pointer __p = data();
|
||||
for (const_pointer __ps = __p + __pos; __ps != __p;)
|
||||
const value_type* __p = data();
|
||||
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
||||
{
|
||||
const_pointer __r = traits_type::find(__s, __n, *--__ps);
|
||||
const value_type* __r = traits_type::find(__s, __n, *--__ps);
|
||||
if (__r)
|
||||
return static_cast<size_type>(__ps - __p);
|
||||
}
|
||||
@@ -3397,7 +3403,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __st
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -3419,7 +3425,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
|
||||
size_type __pos,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
@@ -3429,9 +3435,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s,
|
||||
size_type __sz = size();
|
||||
if (__pos < __sz)
|
||||
{
|
||||
const_pointer __p = data();
|
||||
const_pointer __pe = __p + __sz;
|
||||
for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps)
|
||||
const value_type* __p = data();
|
||||
const value_type* __pe = __p + __sz;
|
||||
for (const value_type* __ps = __p + __pos; __ps != __pe; ++__ps)
|
||||
if (traits_type::find(__s, __n, *__ps) == 0)
|
||||
return static_cast<size_type>(__ps - __p);
|
||||
}
|
||||
@@ -3450,7 +3456,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string&
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -3468,9 +3474,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
||||
size_type __sz = size();
|
||||
if (__pos < __sz)
|
||||
{
|
||||
const_pointer __p = data();
|
||||
const_pointer __pe = __p + __sz;
|
||||
for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps)
|
||||
const value_type* __p = data();
|
||||
const value_type* __pe = __p + __sz;
|
||||
for (const value_type* __ps = __p + __pos; __ps != __pe; ++__ps)
|
||||
if (!traits_type::eq(*__ps, __c))
|
||||
return static_cast<size_type>(__ps - __p);
|
||||
}
|
||||
@@ -3481,7 +3487,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
|
||||
size_type __pos,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
@@ -3493,8 +3499,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s,
|
||||
++__pos;
|
||||
else
|
||||
__pos = __sz;
|
||||
const_pointer __p = data();
|
||||
for (const_pointer __ps = __p + __pos; __ps != __p;)
|
||||
const value_type* __p = data();
|
||||
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
||||
if (traits_type::find(__s, __n, *--__ps) == 0)
|
||||
return static_cast<size_type>(__ps - __p);
|
||||
return npos;
|
||||
@@ -3512,7 +3518,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string&
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s,
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
@@ -3532,8 +3538,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
|
||||
++__pos;
|
||||
else
|
||||
__pos = __sz;
|
||||
const_pointer __p = data();
|
||||
for (const_pointer __ps = __p + __pos; __ps != __p;)
|
||||
const value_type* __p = data();
|
||||
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
||||
if (!traits_type::eq(*--__ps, __c))
|
||||
return static_cast<size_type>(__ps - __p);
|
||||
return npos;
|
||||
@@ -3586,7 +3592,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
int
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -3598,7 +3604,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
int
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
||||
size_type __n1,
|
||||
const_pointer __s) const
|
||||
const value_type* __s) const
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -3610,7 +3616,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
int
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
||||
size_type __n1,
|
||||
const_pointer __s,
|
||||
const value_type* __s,
|
||||
size_type __n2) const
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user