summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/string
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/include/string')
-rw-r--r--contrib/libc++/include/string63
1 files changed, 40 insertions, 23 deletions
diff --git a/contrib/libc++/include/string b/contrib/libc++/include/string
index 9150244..786735f 100644
--- a/contrib/libc++/include/string
+++ b/contrib/libc++/include/string
@@ -98,8 +98,10 @@ public:
basic_string(const basic_string& str);
basic_string(basic_string&& str)
noexcept(is_nothrow_move_constructible<allocator_type>::value);
- basic_string(const basic_string& str, size_type pos, size_type n = npos,
+ basic_string(const basic_string& str, size_type pos,
const allocator_type& a = allocator_type());
+ basic_string(const basic_string& str, size_type pos, size_type n,
+ const Allocator& a = Allocator());
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());
@@ -225,6 +227,7 @@ public:
const value_type* c_str() const noexcept;
const value_type* data() const noexcept;
+ value_type* data() noexcept; // C++17
allocator_type get_allocator() const noexcept;
@@ -958,7 +961,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
// __str_find
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find(const _CharT *__p, _SizeT __sz,
_CharT __c, _SizeT __pos) _NOEXCEPT
{
@@ -971,7 +974,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
}
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{
@@ -982,7 +985,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
const _CharT* __r =
_VSTD::__search(__p + __pos, __p + __sz,
__s, __s + __n, _Traits::eq,
- random_access_iterator_tag(), random_access_iterator_tag());
+ random_access_iterator_tag(), random_access_iterator_tag()).first;
if (__r == __p + __sz)
return __npos;
return static_cast<_SizeT>(__r - __p);
@@ -992,7 +995,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
// __str_rfind
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_rfind(const _CharT *__p, _SizeT __sz,
_CharT __c, _SizeT __pos) _NOEXCEPT
{
@@ -1011,7 +1014,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
}
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_rfind(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{
@@ -1030,7 +1033,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
// __str_find_first_of
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find_first_of(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{
@@ -1046,7 +1049,7 @@ __str_find_first_of(const _CharT *__p, _SizeT __sz,
// __str_find_last_of
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find_last_of(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{
@@ -1069,7 +1072,7 @@ __str_find_last_of(const _CharT *__p, _SizeT __sz,
// __str_find_first_not_of
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{
@@ -1085,7 +1088,7 @@ __str_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
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
_CharT __c, _SizeT __pos) _NOEXCEPT
{
@@ -1102,7 +1105,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz,
// __str_find_last_not_of
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
-_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{
@@ -1118,7 +1121,7 @@ __str_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
+inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
_CharT __c, _SizeT __pos) _NOEXCEPT
{
@@ -1396,7 +1399,10 @@ public:
basic_string(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c, const allocator_type& __a);
- basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
+ basic_string(const basic_string& __str, size_type __pos, size_type __n,
+ const allocator_type& __a = allocator_type());
+ _LIBCPP_INLINE_VISIBILITY
+ basic_string(const basic_string& __str, size_type __pos,
const allocator_type& __a = allocator_type());
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
@@ -1546,7 +1552,7 @@ public:
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
_LIBCPP_INLINE_VISIBILITY
- basic_string& assign(const basic_string& __str);
+ basic_string& assign(const basic_string& __str) { return *this = __str; }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(basic_string&& str)
@@ -1659,6 +1665,10 @@ public:
const value_type* c_str() const _NOEXCEPT {return data();}
_LIBCPP_INLINE_VISIBILITY
const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}
+#if _LIBCPP_STD_VER > 14
+ _LIBCPP_INLINE_VISIBILITY
+ value_type* data() _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}
+#endif
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
@@ -2218,6 +2228,21 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
}
template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_INLINE_VISIBILITY
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
+ const allocator_type& __a)
+ : __r_(__a)
+{
+ size_type __str_sz = __str.size();
+ if (__pos > __str_sz)
+ this->__throw_out_of_range();
+ __init(__str.data() + __pos, __str_sz - __pos);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator>
typename enable_if
<
@@ -2466,7 +2491,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
if (this != &__str)
{
__copy_assign_alloc(__str);
- assign(__str);
+ assign(__str.data(), __str.size());
}
return *this;
}
@@ -2558,14 +2583,6 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str)
-{
- return assign(__str.data(), __str.size());
-}
-
-template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
{
OpenPOWER on IntegriCloud