diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2023-11-02 19:27:12 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2023-11-02 20:14:23 +0300 |
commit | ea7266e3afdfe76274c756747fbd24626e1c205a (patch) | |
tree | 9b8370f3cf8d4399fc960a2c50aa9759f5acf554 /contrib/libs/cxxsupp/libcxx/include/string | |
parent | a528d5d25d42706fe385120b27e1df3a257823fb (diff) | |
download | ydb-ea7266e3afdfe76274c756747fbd24626e1c205a.tar.gz |
Upd libc++ to 14 Jun 2022 1cf4113952ae3e4cc75decdf6feb3ce5dd8ca4a1
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/string')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/string | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index e114b28a6e..4233cdd8cb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -524,10 +524,16 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <__config> #include <__debug> #include <__format/enable_insertable.h> +#include <__functional/hash.h> #include <__functional/unary_function.h> #include <__ios/fpos.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/reverse_iterator.h> #include <__iterator/wrap_iter.h> #include <__memory/allocate_at_least.h> +#include <__string/char_traits.h> +#include <__string/extern_template_lists.h> #include <__utility/auto_cast.h> #include <__utility/move.h> #include <__utility/swap.h> @@ -539,7 +545,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <cstring> #include <initializer_list> #include <iosfwd> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <stdexcept> @@ -547,10 +553,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <type_traits> #include <version> -// TODO: remove these headers -#include <new> -#include <typeinfo> - #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS # include <cwchar> #endif @@ -601,7 +603,7 @@ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&)) +extern template _LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&); template <class _Iter> struct __string_is_trivial_iterator : public false_type {}; @@ -696,8 +698,8 @@ private: { value_type __data_[__min_cap]; unsigned char __padding_[sizeof(value_type) - 1]; - size_type __size_ : 7; - size_type __is_long_ : 1; + unsigned char __size_ : 7; + unsigned char __is_long_ : 1; }; // The __endian_factor is required because the field we use to store the size @@ -740,14 +742,16 @@ private: struct __short { - size_type __is_long_ : 1; - size_type __size_ : 7; + unsigned char __is_long_ : 1; + unsigned char __size_ : 7; char __padding_[sizeof(value_type) - 1]; value_type __data_[__min_cap]; }; #endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT + static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size."); + union __ulx{__long __lx; __short __lxx;}; enum {__n_words = sizeof(__ulx) / sizeof(size_type)}; @@ -817,10 +821,6 @@ public: _NOEXCEPT; #endif -#if _LIBCPP_STD_VER > 17 - basic_string(nullptr_t) = delete; -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(basic_string&& __str, const allocator_type& __a); #endif // _LIBCPP_CXX03_LANG @@ -837,6 +837,9 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const _CharT* __s, const _Allocator& __a); +#if _LIBCPP_STD_VER > 17 + basic_string(nullptr_t) = delete; +#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(nullptr_t, size_t) = delete; @@ -920,7 +923,7 @@ public: #endif _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(value_type __c); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifndef _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator begin() _NOEXCEPT {return iterator(this, __get_pointer());} @@ -934,6 +937,8 @@ public: const_iterator end() const _NOEXCEPT {return const_iterator(this, __get_pointer() + size());} #else + // It is necessary to keep the list of constructors matching the one above it. + // Made to support pointer iterators _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator begin() _NOEXCEPT {return iterator(__get_pointer());} @@ -946,7 +951,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_iterator end() const _NOEXCEPT {return const_iterator(__get_pointer() + size());} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -1473,7 +1479,7 @@ public: constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept { return ends_with(__self_view(__s)); } -//#endif +//#endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER >= 20 constexpr _LIBCPP_HIDE_FROM_ABI @@ -1493,14 +1499,14 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const; bool __decrementable(const const_iterator* __i) const; bool __addable(const const_iterator* __i, ptrdiff_t __n) const; bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE private: template<class _Alloc> @@ -1837,17 +1843,19 @@ private: // These declarations must appear before any functions are implicitly used // so that they have the correct visibility specifier. +#define _LIBCPP_DECLARE(...) extern template __VA_ARGS__; #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char) + _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char) # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t) + _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t) # endif #else - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char) + _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char) # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t) + _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t) # endif #endif +#undef _LIBCPP_DECLARE #if _LIBCPP_STD_VER >= 17 @@ -1883,7 +1891,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) { __c_node* __c = __get_db()->__find_c_and_lock(this); if (__c) @@ -1905,7 +1913,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type } #else (void)__pos; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE } template <class _CharT, class _Traits, class _Allocator> @@ -2462,7 +2470,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr"); - return (_LIBCPP_BUILTIN_CONSTANT_P(__n) && __fits_in_sso(__n)) + return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n); } @@ -2677,7 +2685,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); - return _LIBCPP_BUILTIN_CONSTANT_P(*__s) + return __builtin_constant_p(*__s) ? (__fits_in_sso(traits_type::length(__s)) ? __assign_short(__s, traits_type::length(__s)) : __assign_external(__s, traits_type::length(__s))) @@ -4638,7 +4646,7 @@ inline _LIBCPP_HIDE_FROM_ABI } #endif -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template<class _CharT, class _Traits, class _Allocator> bool @@ -4672,7 +4680,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* return data() <= __p && __p < data() + size(); } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE #if _LIBCPP_STD_VER > 11 // Literal suffixes for basic_string [basic.string.literals] @@ -4729,10 +4737,6 @@ inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> _LIBCPP_END_NAMESPACE_STD -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning ( pop ) -#endif - _LIBCPP_POP_MACROS #endif // _LIBCPP_STRING |