diff options
| author | halyavin <[email protected]> | 2022-07-21 11:17:19 +0300 |
|---|---|---|
| committer | halyavin <[email protected]> | 2022-07-21 11:17:19 +0300 |
| commit | b78ae8ac7797d88986dfa1526ea11fcbdb4f5f6f (patch) | |
| tree | f4368f9265036a664df40ae4943cabd4f272d414 /contrib/libs/cxxsupp/libcxx/include/string | |
| parent | b651f08845dea01bbd05b6b7d56aba3992374706 (diff) | |
Update libc++ to 34313583 (20 Feb 2022).
Notable changes:
* replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI in __filesystem/operations.h
* implement sortable and mergeable concepts
* replace __uncvref with __uncvref_t
* implement consistent stateful allocator behavior in std::basic_string::operator+
* remove some _LIBCPP_CXX03_LANG ifdef's
* move _LIBCPP_ASSERT related code to a separate file
* enable std::hash<Enum> in C++11 mode
* make algorithm includes more granular
* implement range functionality for std::istream_iterator
* add debug check in basic_string::insert
* replace "" with <> in includes in src/ files for consistency with include/
* add push/pop macros defines in src/ files for consistency with include/
* add availability annotations to optional operations
* remove conditional noexcept from view_interface --- this is allowed by the standard
* replace _LIBCPP_SAFE_STATIC with _LIBCPP_CONSTINIT
* guard most of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES
* remove priority pragma for AIX from locale.cpp because it is ignored anyway
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/string')
| -rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/string | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index 0cbe4e06148..d0df0afd160 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -518,11 +518,15 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1 */ +#include <__algorithm/max.h> +#include <__algorithm/min.h> +#include <__algorithm/remove.h> +#include <__algorithm/remove_if.h> +#include <__assert> #include <__config> #include <__debug> #include <__ios/fpos.h> #include <__iterator/wrap_iter.h> -#include <algorithm> #include <compare> #include <cstdio> // EOF #include <cstdlib> @@ -2899,6 +2903,10 @@ template <class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c) { + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, + "string::insert(iterator, character) called with an iterator not" + " referring to this string"); + size_type __ip = static_cast<size_type>(__pos - begin()); size_type __sz = size(); size_type __cap = capacity(); @@ -4182,9 +4190,10 @@ basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) { - basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator()); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size(); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size(); + using _String = basic_string<_CharT, _Traits, _Allocator>; + _String __r(_String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); + typename _String::size_type __lhs_sz = __lhs.size(); + typename _String::size_type __rhs_sz = __rhs.size(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; @@ -4194,9 +4203,10 @@ template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs) { - basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator()); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = _Traits::length(__lhs); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size(); + using _String = basic_string<_CharT, _Traits, _Allocator>; + _String __r(_String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator())); + typename _String::size_type __lhs_sz = _Traits::length(__lhs); + typename _String::size_type __rhs_sz = __rhs.size(); __r.__init(__lhs, __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; @@ -4206,8 +4216,9 @@ template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { - basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator()); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size(); + using _String = basic_string<_CharT, _Traits, _Allocator>; + _String __r(_String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator())); + typename _String::size_type __rhs_sz = __rhs.size(); __r.__init(&__lhs, 1, 1 + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; @@ -4218,9 +4229,10 @@ inline basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) { - basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator()); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size(); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = _Traits::length(__rhs); + using _String = basic_string<_CharT, _Traits, _Allocator>; + _String __r(_String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); + typename _String::size_type __lhs_sz = __lhs.size(); + typename _String::size_type __rhs_sz = _Traits::length(__rhs); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs, __rhs_sz); return __r; @@ -4230,8 +4242,9 @@ template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) { - basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator()); - typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size(); + using _String = basic_string<_CharT, _Traits, _Allocator>; + _String __r(_String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); + typename _String::size_type __lhs_sz = __lhs.size(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + 1); __r.push_back(__rhs); return __r; |
