diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-04-15 02:46:40 +0300 |
---|---|---|
committer | Andrey Khalyavin <halyavin@gmail.com> | 2022-04-15 02:46:40 +0300 |
commit | c5bfd90690e2df55f55d1831b0edd2e1c7241582 (patch) | |
tree | cda6bc446bf17fc110b67126b4c5ddc640fa427b | |
parent | 599463a2ac4bda8536564ec6d7b798447755f05f (diff) | |
download | ydb-c5bfd90690e2df55f55d1831b0edd2e1c7241582.tar.gz |
Update libc++ to b6d87773 (14 Jan 2022).
Notable changes:
* implement operator << for filesystem::directory_entry
* add std::ranges::in_in_result
* add std::ranges::owning_view
* add std::ranges::cdata
* add std::ranges::construct_at and destroy{,_n,_at}
* small fixes in std::ranges::data
* SFINAE away std::ranges::cbegin(const T&&) for non-borrowed T
* use arc4random to implement std::random_device on Apple
* introduce __fits_in_sso to put constexpr check into a central place
* introduce __debug_db_insert_c to put #if and constexpr check into a central place
ref:b3dd06bd52f06e8939227ca0f0a5873d0c211e48
33 files changed, 615 insertions, 415 deletions
diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 7235a93df9..5c5b88fb75 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -9,7 +9,7 @@ FAKEID=3141592653 SANDBOX_FAKEID=${FAKEID}.7600000 -CPP_FAKEID=9306403 +CPP_FAKEID=9334205 GO_FAKEID=9336945 ANDROID_FAKEID=8821472 CLANG_TIDY_FAKEID=8625699 diff --git a/contrib/libs/cxxsupp/libcxx/import b/contrib/libs/cxxsupp/libcxx/import index d6b186ba7f..5bddeafc31 100755 --- a/contrib/libs/cxxsupp/libcxx/import +++ b/contrib/libs/cxxsupp/libcxx/import @@ -1,6 +1,6 @@ #!/bin/sh -e -rev=8d23b742 +rev=b6d87773 output_dir="libcxx-r$rev" if [ -z $1 ] ; then git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp" diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h new file mode 100644 index 0000000000..a1416f4cac --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h @@ -0,0 +1,43 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ALGORITHM_IN_IN_RESULT_H +#define _LIBCPP___ALGORITHM_IN_IN_RESULT_H + +#include <__concepts/convertible_to.h> +#include <__config> +#include <__utility/move.h> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_HAS_NO_RANGES + +namespace ranges { +template <class _I1, class _I2> +struct in_in_result { + _LIBCPP_NO_UNIQUE_ADDRESS _I1 in1; + _LIBCPP_NO_UNIQUE_ADDRESS _I2 in2; + + template <class _II1, class _II2> + requires convertible_to<const _I1&, _II1> && convertible_to<const _I2&, _II2> + constexpr operator in_in_result<_II1, _II2>() const & { + return {in1, in2}; + } + + template <class _II1, class _II2> + requires convertible_to<_I1, _II1> && convertible_to<_I2, _II2> + constexpr operator in_in_result<_II1, _II2>() && { return {_VSTD::move(in1), _VSTD::move(in2)}; } +}; +} // namespace ranges + +#endif // _LIBCPP_HAS_NO_RANGES + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ALGORITHM_IN_IN_RESULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_result.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_result.h index 9d97115720..1aebfa86a4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/in_out_result.h @@ -25,8 +25,8 @@ namespace ranges { template<class _InputIterator, class _OutputIterator> struct in_out_result { - [[no_unique_address]] _InputIterator in; - [[no_unique_address]] _OutputIterator out; + _LIBCPP_NO_UNIQUE_ADDRESS _InputIterator in; + _LIBCPP_NO_UNIQUE_ADDRESS _OutputIterator out; template <class _InputIterator2, class _OutputIterator2> requires convertible_to<const _InputIterator&, _InputIterator2> && convertible_to<const _OutputIterator&, diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index 6f848cf618..0dab7c7235 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -133,6 +133,13 @@ # define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr # define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI +// std::random_device holds some state when it uses an implementation that gets +// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this +// implementation to another one on a platform that has already shipped +// std::random_device, one needs to retain the same object layout to remain ABI +// compatible. This switch removes these workarounds for platforms that don't care +// about ABI compatibility. +# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT #elif _LIBCPP_ABI_VERSION == 1 # if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support @@ -383,7 +390,7 @@ // Use rand_s(), for use on Windows. // When this option is used, the token passed to `std::random_device`'s // constructor *must* be "/dev/urandom" -- anything else is an error. -#if defined(__OpenBSD__) +#if defined(__OpenBSD__) || defined(__APPLE__) # define _LIBCPP_USING_ARC4_RANDOM #elif defined(__wasi__) # define _LIBCPP_USING_GETENTROPY @@ -1483,6 +1490,28 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( # define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ #endif +#if __has_cpp_attribute(msvc::no_unique_address) + // MSVC implements [[no_unique_address]] as a silent no-op currently. + // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) + // However, MSVC implements [[msvc::no_unique_address]] which does what + // [[no_unique_address]] is supposed to do, in general. + + // Clang-cl does not yet (14.0) implement either [[no_unique_address]] or + // [[msvc::no_unique_address]] though. If/when it does implement + // [[msvc::no_unique_address]], this should be preferred though. +# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +#elif __has_cpp_attribute(no_unique_address) +# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ + // Note that this can be replaced by #error as soon as clang-cl + // implements msvc::no_unique_address, since there should be no C++20 + // compiler that doesn't support one of the two attributes at that point. + // We geenrally don't want to use this macro outside of C++20-only code, + // because using it conditionally in one language version only would make + // the ABI inconsistent. +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG diff --git a/contrib/libs/cxxsupp/libcxx/include/__debug b/contrib/libs/cxxsupp/libcxx/include/__debug index 42f6cef4c0..29c51b2f2f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__debug +++ b/contrib/libs/cxxsupp/libcxx/include/__debug @@ -12,6 +12,7 @@ #include <__config> #include <iosfwd> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -22,9 +23,9 @@ #endif #if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY) -# include <cstdlib> -# include <cstdio> # include <cstddef> +# include <cstdio> +# include <cstdlib> #endif #if _LIBCPP_DEBUG_LEVEL == 0 @@ -268,6 +269,16 @@ _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); #endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) { +#if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) + __get_db()->__insert_c(__c); +#else + (void)(__c); +#endif +} + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_DEBUG_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h index ba3ecfe78f..91dd1a2145 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h @@ -23,6 +23,7 @@ #include <chrono> #include <cstdint> #include <cstdlib> +#include <iosfwd> #include <system_error> _LIBCPP_PUSH_MACROS @@ -239,6 +240,12 @@ public: return __p_ >= __rhs.__p_; } + template <class _CharT, class _Traits> + _LIBCPP_INLINE_VISIBILITY + friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) { + return __os << __d.path(); + } + private: friend class directory_iterator; friend class recursive_directory_iterator; diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h index 3ce88fadbe..22af2efffa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h @@ -65,7 +65,7 @@ class counted_iterator , public __counted_iterator_value_type<_Iter> { public: - [[no_unique_address]] _Iter __current_ = _Iter(); + _LIBCPP_NO_UNIQUE_ADDRESS _Iter __current_ = _Iter(); iter_difference_t<_Iter> __count_ = 0; using iterator_type = _Iter; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h b/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h index 3b58451c50..580ce781f4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/construct_at.h @@ -14,6 +14,7 @@ #include <__debug> #include <__iterator/access.h> #include <__memory/addressof.h> +#include <__memory/voidify.h> #include <__utility/forward.h> #include <type_traits> #include <utility> @@ -31,10 +32,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD template<class _Tp, class ..._Args, class = decltype( ::new (declval<void*>()) _Tp(declval<_Args>()...) )> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) { _LIBCPP_ASSERT(__location, "null pointer given to construct_at"); - return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...); + return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); } #endif @@ -46,7 +47,7 @@ constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) { template <class _ForwardIterator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -void __destroy(_ForwardIterator, _ForwardIterator); +_ForwardIterator __destroy(_ForwardIterator, _ForwardIterator); template <class _Tp, typename enable_if<!is_array<_Tp>::value, int>::type = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -66,9 +67,10 @@ void __destroy_at(_Tp* __loc) { template <class _ForwardIterator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 -void __destroy(_ForwardIterator __first, _ForwardIterator __last) { +_ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) { for (; __first != __last; ++__first) _VSTD::__destroy_at(_VSTD::addressof(*__first)); + return __first; } #if _LIBCPP_STD_VER > 14 @@ -90,7 +92,7 @@ void destroy_at(_Tp* __loc) { template <class _ForwardIterator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void destroy(_ForwardIterator __first, _ForwardIterator __last) { - _VSTD::__destroy(_VSTD::move(__first), _VSTD::move(__last)); + (void)_VSTD::__destroy(_VSTD::move(__first), _VSTD::move(__last)); } template <class _ForwardIterator, class _Size> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h new file mode 100644 index 0000000000..99ae299089 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h @@ -0,0 +1,144 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___MEMORY_RANGES_CONSTRUCT_AT_H +#define _LIBCPP___MEMORY_RANGES_CONSTRUCT_AT_H + +#include <__concepts/destructible.h> +#include <__config> +#include <__function_like.h> +#include <__iterator/incrementable_traits.h> +#include <__iterator/readable_traits.h> +#include <__memory/concepts.h> +#include <__memory/construct_at.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__utility/declval.h> +#include <__utility/forward.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_HAS_NO_RANGES) +namespace ranges { + +// construct_at + +namespace __construct_at { + +struct __fn final : private __function_like { + + _LIBCPP_HIDE_FROM_ABI + constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} + + template<class _Tp, class... _Args, class = decltype( + ::new (declval<void*>()) _Tp(declval<_Args>()...) + )> + _LIBCPP_HIDE_FROM_ABI + constexpr _Tp* operator()(_Tp* __location, _Args&& ...__args) const { + return _VSTD::construct_at(__location, _VSTD::forward<_Args>(__args)...); + } + +}; + +} // namespace __construct_at + +inline namespace __cpo { +inline constexpr auto construct_at = __construct_at::__fn(__function_like::__tag()); +} // namespace __cpo + +// destroy_at + +namespace __destroy_at { + +struct __fn final : private __function_like { + + _LIBCPP_HIDE_FROM_ABI + constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} + + template <destructible _Tp> + _LIBCPP_HIDE_FROM_ABI + constexpr void operator()(_Tp* __location) const noexcept { + _VSTD::destroy_at(__location); + } + +}; + +} // namespace __destroy_at + +inline namespace __cpo { +inline constexpr auto destroy_at = __destroy_at::__fn(__function_like::__tag()); +} // namespace __cpo + +// destroy + +namespace __destroy { + +struct __fn final : private __function_like { + + _LIBCPP_HIDE_FROM_ABI + constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} + + template <__nothrow_input_iterator _InputIterator, __nothrow_sentinel_for<_InputIterator> _Sentinel> + requires destructible<iter_value_t<_InputIterator>> + _LIBCPP_HIDE_FROM_ABI + constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept { + return _VSTD::__destroy(_VSTD::move(__first), _VSTD::move(__last)); + } + + template <__nothrow_input_range _InputRange> + requires destructible<range_value_t<_InputRange>> + _LIBCPP_HIDE_FROM_ABI + constexpr borrowed_iterator_t<_InputRange> operator()(_InputRange&& __range) const noexcept { + return (*this)(ranges::begin(__range), ranges::end(__range)); + } + +}; + +} // namespace __destroy + +inline namespace __cpo { +inline constexpr auto destroy = __destroy::__fn(__function_like::__tag()); +} // namespace __cpo + +// destroy_n + +namespace __destroy_n { + +struct __fn final : private __function_like { + + _LIBCPP_HIDE_FROM_ABI + constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} + + template <__nothrow_input_iterator _InputIterator> + requires destructible<iter_value_t<_InputIterator>> + _LIBCPP_HIDE_FROM_ABI + constexpr _InputIterator operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept { + return _VSTD::destroy_n(_VSTD::move(__first), __n); + } + +}; + +} // namespace __destroy_n + +inline namespace __cpo { +inline constexpr auto destroy_n = __destroy_n::__fn(__function_like::__tag()); +} // namespace __cpo + +} // namespace ranges +#endif // !defined(_LIBCPP_HAS_NO_RANGES) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___MEMORY_RANGES_CONSTRUCT_AT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h b/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h index 835f726fdb..ef11977f9b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h @@ -27,7 +27,26 @@ class _LIBCPP_TYPE_VIS random_device { #ifdef _LIBCPP_USING_DEV_RANDOM int __f_; +#elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT) +# if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-private-field" +# endif + + // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now + // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we + // retain the same layout as before. +# if defined(__APPLE__) + int __padding_; // padding to fake the `__f_` field above +# endif + + // ... vendors can add workarounds here if they switch to a different representation ... + +# if defined(__clang__) +# pragma clang diagnostic pop +# endif #endif + public: // types typedef unsigned result_type; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h index 246f8b20ca..0b9470fa40 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h @@ -163,11 +163,12 @@ namespace ranges { namespace __cbegin { struct __fn { template <class _Tp> + requires is_lvalue_reference_v<_Tp&&> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Tp& __t) const - noexcept(noexcept(ranges::begin(static_cast<const _Tp&>(__t)))) - -> decltype( ranges::begin(static_cast<const _Tp&>(__t))) - { return ranges::begin(static_cast<const _Tp&>(__t)); } + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)); } template <class _Tp> requires is_rvalue_reference_v<_Tp&&> @@ -190,11 +191,12 @@ namespace ranges { namespace __cend { struct __fn { template <class _Tp> + requires is_lvalue_reference_v<_Tp&&> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Tp& __t) const - noexcept(noexcept(ranges::end(static_cast<const _Tp&>(__t)))) - -> decltype( ranges::end(static_cast<const _Tp&>(__t))) - { return ranges::end(static_cast<const _Tp&>(__t)); } + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)); } template <class _Tp> requires is_rvalue_reference_v<_Tp&&> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h index ccc77258ba..90327da814 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h @@ -14,9 +14,9 @@ #include <__iterator/iterator_traits.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__ranges/owning_view.h> #include <__ranges/range_adaptor.h> #include <__ranges/ref_view.h> -#include <__ranges/subrange.h> #include <__utility/auto_cast.h> #include <__utility/declval.h> #include <__utility/forward.h> @@ -56,12 +56,12 @@ namespace __all { template<class _Tp> requires (!ranges::view<decay_t<_Tp>> && !requires (_Tp&& __t) { ranges::ref_view{_VSTD::forward<_Tp>(__t)}; } && - requires (_Tp&& __t) { ranges::subrange{_VSTD::forward<_Tp>(__t)}; }) + requires (_Tp&& __t) { ranges::owning_view{_VSTD::forward<_Tp>(__t)}; }) [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::subrange{_VSTD::forward<_Tp>(__t)})) + noexcept(noexcept(ranges::owning_view{_VSTD::forward<_Tp>(__t)})) { - return ranges::subrange{_VSTD::forward<_Tp>(__t)}; + return ranges::owning_view{_VSTD::forward<_Tp>(__t)}; } }; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h index bad23c8c4b..fa31074ab6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h @@ -9,6 +9,9 @@ #ifndef _LIBCPP___RANGES_CONCEPTS_H #define _LIBCPP___RANGES_CONCEPTS_H +#include <__concepts/constructible.h> +#include <__concepts/movable.h> +#include <__concepts/same_as.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> @@ -20,7 +23,7 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> -#include <concepts> +#include <initializer_list> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -114,12 +117,20 @@ namespace ranges { template <class _Tp> concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>; - template<class _Tp> + template <class _Tp> + inline constexpr bool __is_std_initializer_list = false; + + template <class _Ep> + inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true; + + template <class _Tp> concept viewable_range = - range<_Tp> && ( - (view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) || - (!view<remove_cvref_t<_Tp>> && borrowed_range<_Tp>) - ); + range<_Tp> && + ((view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) || + (!view<remove_cvref_t<_Tp>> && + (is_lvalue_reference_v<_Tp> || + (movable<remove_reference_t<_Tp>> && !__is_std_initializer_list<remove_cvref_t<_Tp>>)))); + } // namespace ranges #endif // !defined(_LIBCPP_HAS_NO_RANGES) diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h index 4811690ada..c32596f17c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/copyable_box.h @@ -41,7 +41,7 @@ namespace ranges { // Primary template - uses std::optional and introduces an empty state in case assignment fails. template<__copy_constructible_object _Tp> class __copyable_box { - [[no_unique_address]] optional<_Tp> __val_; + _LIBCPP_NO_UNIQUE_ADDRESS optional<_Tp> __val_; public: template<class ..._Args> @@ -116,7 +116,7 @@ namespace ranges { template<__copy_constructible_object _Tp> requires __doesnt_need_empty_state_for_copy<_Tp> && __doesnt_need_empty_state_for_move<_Tp> class __copyable_box<_Tp> { - [[no_unique_address]] _Tp __val_; + _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; public: template<class ..._Args> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h index cc151c59f3..69dfd479c0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h @@ -9,13 +9,13 @@ #ifndef _LIBCPP___RANGES_DATA_H #define _LIBCPP___RANGES_DATA_H +#include <__concepts/class_or_enum.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> #include <__ranges/access.h> -#include <__utility/forward.h> -#include <concepts> +#include <__utility/auto_cast.h> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -35,34 +35,33 @@ namespace __data { template <class _Tp> concept __member_data = + __can_borrow<_Tp> && + __workaround_52970<_Tp> && requires(_Tp&& __t) { - { _VSTD::forward<_Tp>(__t) } -> __can_borrow; - { __t.data() } -> __ptr_to_object; + { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object; }; template <class _Tp> concept __ranges_begin_invocable = !__member_data<_Tp> && + __can_borrow<_Tp> && requires(_Tp&& __t) { - { _VSTD::forward<_Tp>(__t) } -> __can_borrow; - { ranges::begin(_VSTD::forward<_Tp>(__t)) } -> contiguous_iterator; + { ranges::begin(__t) } -> contiguous_iterator; }; struct __fn { template <__member_data _Tp> - requires __can_borrow<_Tp> _LIBCPP_HIDE_FROM_ABI - constexpr __ptr_to_object auto operator()(_Tp&& __t) const + constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) { return __t.data(); } template<__ranges_begin_invocable _Tp> - requires __can_borrow<_Tp> _LIBCPP_HIDE_FROM_ABI - constexpr __ptr_to_object auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::to_address(ranges::begin(_VSTD::forward<_Tp>(__t))))) { - return _VSTD::to_address(ranges::begin(_VSTD::forward<_Tp>(__t))); + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(_VSTD::to_address(ranges::begin(__t)))) { + return _VSTD::to_address(ranges::begin(__t)); } }; } @@ -72,6 +71,34 @@ inline namespace __cpo { } // namespace __cpo } // namespace ranges +// [range.prim.cdata] + +namespace ranges { +namespace __cdata { + struct __fn { + template <class _Tp> + requires is_lvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)))) + -> decltype( ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))) + { return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)); } + + template <class _Tp> + requires is_rvalue_reference_v<_Tp&&> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_Tp&& __t) const + noexcept(noexcept(ranges::data(static_cast<const _Tp&&>(__t)))) + -> decltype( ranges::data(static_cast<const _Tp&&>(__t))) + { return ranges::data(static_cast<const _Tp&&>(__t)); } + }; +} + +inline namespace __cpo { + inline constexpr auto cdata = __cdata::__fn{}; +} // namespace __cpo +} // namespace ranges + #endif // !defined(_LIBCPP_HAS_NO_RANGES) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h index 6adb09cf67..8d1ac87c93 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h @@ -45,7 +45,7 @@ namespace ranges { // one can't call begin() on it more than once. static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>); using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>; - [[no_unique_address]] _Cache __cached_begin_ = _Cache(); + _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); range_difference_t<_View> __count_ = 0; _View __base_ = _View(); diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h index 9aa69da76c..8dbafc7bd9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/join_view.h @@ -67,7 +67,7 @@ namespace ranges { static constexpr bool _UseCache = !is_reference_v<_InnerRange>; using _Cache = _If<_UseCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>; - [[no_unique_address]] _Cache __cache_; + _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cache_; _View __base_ = _View(); // TODO: [[no_unique_address]] makes clang crash! File a bug :) public: diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h new file mode 100644 index 0000000000..29182d2d8e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/owning_view.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCPP___RANGES_OWNING_VIEW_H +#define _LIBCPP___RANGES_OWNING_VIEW_H + +#include <__concepts/constructible.h> +#include <__concepts/movable.h> +#include <__config> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/data.h> +#include <__ranges/empty.h> +#include <__ranges/enable_borrowed_range.h> +#include <__ranges/size.h> +#include <__ranges/view_interface.h> +#include <__utility/move.h> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_HAS_NO_RANGES) + +namespace ranges { + template<range _Rp> + requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>) + class owning_view : public view_interface<owning_view<_Rp>> { + _Rp __r_ = _Rp(); + +public: + owning_view() requires default_initializable<_Rp> = default; + _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(_VSTD::move(__r)) {} + + owning_view(owning_view&&) = default; + owning_view& operator=(owning_view&&) = default; + + _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; } + _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return _VSTD::move(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return _VSTD::move(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires range<const _Rp> { return ranges::begin(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto end() const requires range<const _Rp> { return ranges::end(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr bool empty() requires requires { ranges::empty(__r_); } + { return ranges::empty(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const requires requires { ranges::empty(__r_); } + { return ranges::empty(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr auto size() requires sized_range<_Rp> + { return ranges::size(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires sized_range<const _Rp> + { return ranges::size(__r_); } + + _LIBCPP_HIDE_FROM_ABI constexpr auto data() requires contiguous_range<_Rp> + { return ranges::data(__r_); } + _LIBCPP_HIDE_FROM_ABI constexpr auto data() const requires contiguous_range<const _Rp> + { return ranges::data(__r_); } + }; + + template<class _Tp> + inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>; + +} // namespace ranges + +#endif // !defined(_LIBCPP_HAS_NO_RANGES) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___RANGES_OWNING_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h index 618be80457..f46df52259 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/reverse_view.h @@ -43,8 +43,8 @@ namespace ranges { // amortized O(1) begin() method. static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>; using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>; - [[no_unique_address]] _Cache __cached_begin_ = _Cache(); - [[no_unique_address]] _View __base_ = _View(); + _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); + _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); public: _LIBCPP_HIDE_FROM_ABI diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h index 8e984f2bf0..76adbffef6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h @@ -80,9 +80,9 @@ namespace ranges { static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics struct _Empty { constexpr _Empty(auto) noexcept { } }; using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>; - [[no_unique_address]] _Iter __begin_ = _Iter(); - [[no_unique_address]] _Sent __end_ = _Sent(); - [[no_unique_address]] _Size __size_ = 0; + _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter(); + _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent(); + _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0; public: _LIBCPP_HIDE_FROM_ABI diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h index 73a57fe96c..b1d6ab2afa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h @@ -39,7 +39,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template<view _View> class take_view : public view_interface<take_view<_View>> { - [[no_unique_address]] _View __base_ = _View(); + _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); range_difference_t<_View> __count_ = 0; template<bool> class __sentinel; @@ -136,7 +136,7 @@ namespace ranges { using _Base = __maybe_const<_Const, _View>; template<bool _OtherConst> using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>; - [[no_unique_address]] sentinel_t<_Base> __end_ = sentinel_t<_Base>(); + _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>(); template<bool> friend class take_view<_View>::__sentinel; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h index 0f53fbaa7e..020f51af8c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h @@ -62,8 +62,8 @@ class transform_view : public view_interface<transform_view<_View, _Fn>> { template<bool> class __iterator; template<bool> class __sentinel; - [[no_unique_address]] __copyable_box<_Fn> __func_; - [[no_unique_address]] _View __base_ = _View(); + _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Fn> __func_; + _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); public: _LIBCPP_HIDE_FROM_ABI diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index 5f77952a9d..38e8c1bfa1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -18,6 +18,11 @@ namespace std { +namespace ranges { + template <class I1, class I2> + struct in_in_result; // since C++20 +} + template <class InputIterator, class Predicate> constexpr bool // constexpr in C++20 all_of(InputIterator first, InputIterator last, Predicate pred); @@ -691,6 +696,7 @@ template<class InputIterator, class OutputIterator> #include <__algorithm/generate.h> #include <__algorithm/generate_n.h> #include <__algorithm/half_positive.h> +#include <__algorithm/in_in_result.h> #include <__algorithm/in_out_result.h> #include <__algorithm/includes.h> #include <__algorithm/inplace_merge.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index b5a7174740..7e1c7549e0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -853,16 +853,12 @@ public: list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } _LIBCPP_INLINE_VISIBILITY explicit list(const allocator_type& __a) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } explicit list(size_type __n); #if _LIBCPP_STD_VER > 11 @@ -872,9 +868,7 @@ public: template <class = __enable_if_t<__is_allocator<_Alloc>::value> > list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __n > 0; --__n) push_back(__x); } @@ -1201,9 +1195,7 @@ list<_Tp, _Alloc>::__iterator(size_type __n) template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __n > 0; --__n) #ifndef _LIBCPP_CXX03_LANG emplace_back(); @@ -1216,9 +1208,7 @@ list<_Tp, _Alloc>::list(size_type __n) template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __n > 0; --__n) emplace_back(); } @@ -1227,9 +1217,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __n > 0; --__n) push_back(__x); } @@ -1239,9 +1227,7 @@ template <class _InpIter> list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __f != __l; ++__f) __emplace_back(*__f); } @@ -1252,9 +1238,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __f != __l; ++__f) __emplace_back(*__f); } @@ -1263,9 +1247,7 @@ template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(const list& __c) : base(__node_alloc_traits::select_on_container_copy_construction( __c.__node_alloc())) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) push_back(*__i); } @@ -1274,9 +1256,7 @@ template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(const list& __c, const __identity_t<allocator_type>& __a) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) push_back(*__i); } @@ -1287,9 +1267,7 @@ template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i) push_back(*__i); @@ -1298,9 +1276,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(initializer_list<value_type> __il) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i) push_back(*__i); @@ -1308,11 +1284,9 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il) template <class _Tp, class _Alloc> inline list<_Tp, _Alloc>::list(list&& __c) - _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value) - : base(_VSTD::move(__c.__node_alloc())) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value) + : base(_VSTD::move(__c.__node_alloc())) { + _VSTD::__debug_db_insert_c(this); splice(end(), __c); } @@ -1321,9 +1295,7 @@ inline list<_Tp, _Alloc>::list(list&& __c, const __identity_t<allocator_type>& __a) : base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__a == __c.get_allocator()) splice(end(), __c); else diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index f4d390c039..8795c38473 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -244,15 +244,40 @@ ForwardIterator uninitialized_fill_n(ForwardIterator first, iter_difference_t<Fo template <class T, class ...Args> constexpr T* construct_at(T* location, Args&& ...args); // since C++20 +namespace ranges { + template<class T, class... Args> + constexpr T* construct_at(T* location, Args&&... args); // since C++20 +} + template <class T> void destroy_at(T* location); // constexpr in C++20 +namespace ranges { + template<destructible T> + constexpr void destroy_at(T* location) noexcept; // since C++20 +} + template <class ForwardIterator> void destroy(ForwardIterator first, ForwardIterator last); // constexpr in C++20 +namespace ranges { + template<nothrow-input-iterator InputIterator, nothrow-sentinel-for<InputIterator> Sentinel> + requires destructible<iter_value_t<InputIterator>> + constexpr InputIterator destroy(InputIterator first, Sentinel last) noexcept; // since C++20 + template<nothrow-input-range InputRange> + requires destructible<range_value_t<InputRange>> + constexpr borrowed_iterator_t<InputRange> destroy(InputRange&& range) noexcept; // since C++20 +} + template <class ForwardIterator, class Size> ForwardIterator destroy_n(ForwardIterator first, Size n); // constexpr in C++20 +namespace ranges { + template<nothrow-input-iterator InputIterator> + requires destructible<iter_value_t<InputIterator>> + constexpr InputIterator destroy_n(InputIterator first, iter_difference_t<InputIterator> n) noexcept; // since C++20 +} + template <class InputIterator, class ForwardIterator> ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result); @@ -790,6 +815,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #include <__memory/concepts.h> #include <__memory/construct_at.h> #include <__memory/pointer_traits.h> +#include <__memory/ranges_construct_at.h> #include <__memory/ranges_uninitialized_algorithms.h> #include <__memory/raw_storage_iterator.h> #include <__memory/shared_ptr.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index 305fe1bc9d..e7f197ec83 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -246,6 +246,7 @@ module std [system] { module generate { private header "__algorithm/generate.h" } module generate_n { private header "__algorithm/generate_n.h" } module half_positive { private header "__algorithm/half_positive.h" } + module in_in_result { private header "__algorithm/in_in_result.h" } module in_out_result { private header "__algorithm/in_out_result.h" } module includes { private header "__algorithm/includes.h" } module inplace_merge { private header "__algorithm/inplace_merge.h" } @@ -661,6 +662,10 @@ module std [system] { module concepts { private header "__memory/concepts.h" } module construct_at { private header "__memory/construct_at.h" } module pointer_traits { private header "__memory/pointer_traits.h" } + module ranges_construct_at { + private header "__memory/ranges_construct_at.h" + export __function_like + } module ranges_uninitialized_algorithms { private header "__memory/ranges_uninitialized_algorithms.h" export __function_like @@ -795,6 +800,7 @@ module std [system] { module iota_view { private header "__ranges/iota_view.h" } module join_view { private header "__ranges/join_view.h" } module non_propagating_cache { private header "__ranges/non_propagating_cache.h" } + module owning_view { private header "__ranges/owning_view.h" } module range_adaptor { private header "__ranges/range_adaptor.h" } module ref_view { private header "__ranges/ref_view.h" } module reverse_view { private header "__ranges/reverse_view.h" } diff --git a/contrib/libs/cxxsupp/libcxx/include/ranges b/contrib/libs/cxxsupp/libcxx/include/ranges index 707c7acd1b..eb4492376c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ranges +++ b/contrib/libs/cxxsupp/libcxx/include/ranges @@ -135,6 +135,13 @@ namespace std::ranges { template<class T> inline constexpr bool enable_borrowed_range<ref_view<T>> = true; + template<range R> + requires see below + class owning_view; + + template<class T> + inline constexpr bool enable_borrowed_range<owning_view<T>> = enable_borrowed_range<T>; + // [range.drop], drop view template<view V> class drop_view; diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index 4103c59a5d..95c7d1daec 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -846,10 +846,7 @@ public: basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); __init(__s, traits_type::length(__s)); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > @@ -1501,6 +1498,11 @@ public: #endif // _LIBCPP_DEBUG_LEVEL == 2 private: + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { + // SSO is disabled during constant evaluation because `__is_long` isn't constexpr friendly + return !__libcpp_is_constant_evaluated() && (__sz < __min_cap); + } + _LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() _NOEXCEPT {return __r_.second();} @@ -1873,10 +1875,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) : __r_(__default_init_tag(), __default_init_tag()) { -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __zero(); } @@ -1890,10 +1889,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ #endif : __r_(__default_init_tag(), __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __zero(); } @@ -1905,7 +1901,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, if (__reserve > max_size()) this->__throw_length_error(); pointer __p; - if (__reserve < __min_cap) + if (__fits_in_sso(__reserve)) { __set_short_size(__sz); __p = __get_short_pointer(); @@ -1929,7 +1925,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty if (__sz > max_size()) this->__throw_length_error(); pointer __p; - if (__sz < __min_cap) + if (__fits_in_sso(__sz)) { __set_short_size(__sz); __p = __get_short_pointer(); @@ -1953,10 +1949,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const { _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); __init(__s, traits_type::length(__s)); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -1964,12 +1957,9 @@ inline basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n) : __r_(__default_init_tag(), __default_init_tag()) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); - __init(__s, __n); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); + __init(__s, __n); + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -1979,10 +1969,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ { _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); __init(__s, __n); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -1994,11 +1981,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st else __init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); - -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2011,17 +1994,14 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( else __init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external( const value_type* __s, size_type __sz) { pointer __p; - if (__sz < __min_cap) { + if (__fits_in_sso(__sz)) { __p = __get_short_pointer(); __set_short_size(__sz); } else { @@ -2049,12 +2029,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) : __r_(_VSTD::move(__str.__r_)) { __str.__zero(); + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) { - __get_db()->__insert_c(this); - if (__is_long()) - __get_db()->swap(this, &__str); - } + if (!__libcpp_is_constant_evaluated() && __is_long()) + __get_db()->swap(this, &__str); #endif } @@ -2070,12 +2048,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co __r_.first().__r = __str.__r_.first().__r; __str.__zero(); } + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) { - __get_db()->__insert_c(this); - if (__is_long()) - __get_db()->swap(this, &__str); - } + if (!__libcpp_is_constant_evaluated() && __is_long()) + __get_db()->swap(this, &__str); #endif } @@ -2088,7 +2064,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) if (__n > max_size()) this->__throw_length_error(); pointer __p; - if (__n < __min_cap) + if (__fits_in_sso(__n)) { __set_short_size(__n); __p = __get_short_pointer(); @@ -2111,10 +2087,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ : __r_(__default_init_tag(), __default_init_tag()) { __init(__n, __c); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2123,10 +2096,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ : __r_(__default_init_tag(), __a) { __init(__n, __c); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2139,10 +2109,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st if (__pos > __str_sz) this->__throw_out_of_range(); __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos)); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2155,10 +2122,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st if (__pos > __str_sz) this->__throw_out_of_range(); __init(__str.data() + __pos, __str_sz - __pos); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2170,10 +2134,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( __self_view __sv0 = __t; __self_view __sv = __sv0.substr(__pos, __n); __init(__sv.data(), __sv.size()); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2183,10 +2144,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) { __self_view __sv = __t; __init(__sv.data(), __sv.size()); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2196,10 +2154,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _ { __self_view __sv = __t; __init(__sv.data(), __sv.size()); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2240,7 +2195,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For if (__sz > max_size()) this->__throw_length_error(); pointer __p; - if (__sz < __min_cap) + if (__fits_in_sso(__sz)) { __set_short_size(__sz); __p = __get_short_pointer(); @@ -2279,10 +2234,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, : __r_(__default_init_tag(), __default_init_tag()) { __init(__first, __last); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2293,10 +2245,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, : __r_(__default_init_tag(), __a) { __init(__first, __last); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } #ifndef _LIBCPP_CXX03_LANG @@ -2308,10 +2257,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( : __r_(__default_init_tag(), __default_init_tag()) { __init(__il.begin(), __il.end()); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _CharT, class _Traits, class _Allocator> @@ -2322,10 +2268,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( : __r_(__default_init_tag(), __a) { __init(__il.begin(), __il.end()); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (!__libcpp_is_constant_evaluated()) - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } #endif // _LIBCPP_CXX03_LANG @@ -2444,7 +2387,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) && __n < __min_cap) + return (_LIBCPP_BUILTIN_CONSTANT_P(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n); } @@ -2647,7 +2590,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); return _LIBCPP_BUILTIN_CONSTANT_P(*__s) - ? (traits_type::length(__s) < __min_cap + ? (__fits_in_sso(traits_type::length(__s)) ? __assign_short(__s, traits_type::length(__s)) : __assign_external(__s, traits_type::length(__s))) : __assign_external(__s); diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index 49edb8765b..3520fe2066 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -1068,11 +1068,9 @@ public: _LIBCPP_INLINE_VISIBILITY unordered_map() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - } + { + _VSTD::__debug_db_insert_c(this); + } explicit unordered_map(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(size_type __n, const hasher& __hf, @@ -1625,9 +1623,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -1637,9 +1633,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -1649,9 +1643,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const allocator_type& __a) : __table_(typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> @@ -1659,9 +1651,7 @@ template <class _InputIterator> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( _InputIterator __first, _InputIterator __last) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__first, __last); } @@ -1672,9 +1662,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -1686,9 +1674,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -1698,9 +1684,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const unordered_map& __u) : __table_(__u.__table_) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -1710,9 +1694,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const unordered_map& __u, const allocator_type& __a) : __table_(__u.__table_, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -1726,8 +1708,8 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) : __table_(_VSTD::move(__u.__table_)) { + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); __get_db()->swap(this, &__u); #endif } @@ -1737,9 +1719,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( unordered_map&& __u, const allocator_type& __a) : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__a != __u.get_allocator()) { iterator __i = __u.begin(); @@ -1758,9 +1738,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list<value_type> __il) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__il.begin(), __il.end()); } @@ -1770,9 +1748,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } @@ -1783,9 +1759,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } @@ -2003,11 +1977,9 @@ public: _LIBCPP_INLINE_VISIBILITY unordered_multimap() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - } + { + _VSTD::__debug_db_insert_c(this); + } explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_multimap(size_type __n, const hasher& __hf, @@ -2427,9 +2399,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -2439,9 +2409,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -2450,9 +2418,7 @@ template <class _InputIterator> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( _InputIterator __first, _InputIterator __last) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__first, __last); } @@ -2463,9 +2429,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -2477,9 +2441,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -2490,9 +2452,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const allocator_type& __a) : __table_(typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> @@ -2500,9 +2460,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const unordered_multimap& __u) : __table_(__u.__table_) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -2512,9 +2470,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const unordered_multimap& __u, const allocator_type& __a) : __table_(__u.__table_, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -2528,8 +2484,8 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) : __table_(_VSTD::move(__u.__table_)) { + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); __get_db()->swap(this, &__u); #endif } @@ -2539,9 +2495,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( unordered_multimap&& __u, const allocator_type& __a) : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__a != __u.get_allocator()) { iterator __i = __u.begin(); @@ -2561,9 +2515,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list<value_type> __il) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__il.begin(), __il.end()); } @@ -2573,9 +2525,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } @@ -2586,9 +2536,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index 1b62e31bb9..ad58fda24f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -524,11 +524,9 @@ public: _LIBCPP_INLINE_VISIBILITY unordered_set() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - } + { + _VSTD::__debug_db_insert_c(this); + } explicit unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); #if _LIBCPP_STD_VER > 11 @@ -935,9 +933,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -946,9 +942,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -957,9 +951,7 @@ template <class _InputIterator> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( _InputIterator __first, _InputIterator __last) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__first, __last); } @@ -970,9 +962,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -984,9 +974,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -997,9 +985,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const allocator_type& __a) : __table_(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _Value, class _Hash, class _Pred, class _Alloc> @@ -1007,9 +993,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const unordered_set& __u) : __table_(__u.__table_) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -1019,9 +1003,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const unordered_set& __u, const allocator_type& __a) : __table_(__u.__table_, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -1035,8 +1017,8 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) : __table_(_VSTD::move(__u.__table_)) { + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); __get_db()->swap(this, &__u); #endif } @@ -1046,9 +1028,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( unordered_set&& __u, const allocator_type& __a) : __table_(_VSTD::move(__u.__table_), __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__a != __u.get_allocator()) { iterator __i = __u.begin(); @@ -1065,9 +1045,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list<value_type> __il) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__il.begin(), __il.end()); } @@ -1077,9 +1055,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } @@ -1090,9 +1066,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } @@ -1223,11 +1197,9 @@ public: _LIBCPP_INLINE_VISIBILITY unordered_multiset() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - } + { + _VSTD::__debug_db_insert_c(this); + } explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_multiset(size_type __n, const hasher& __hf, @@ -1601,9 +1573,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -1613,9 +1583,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const allocator_type& __a) : __table_(__hf, __eql, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); } @@ -1624,9 +1592,7 @@ template <class _InputIterator> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( _InputIterator __first, _InputIterator __last) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__first, __last); } @@ -1637,9 +1603,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -1651,9 +1615,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__first, __last); } @@ -1664,9 +1626,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const allocator_type& __a) : __table_(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } template <class _Value, class _Hash, class _Pred, class _Alloc> @@ -1674,9 +1634,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const unordered_multiset& __u) : __table_(__u.__table_) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -1686,9 +1644,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const unordered_multiset& __u, const allocator_type& __a) : __table_(__u.__table_, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } @@ -1702,8 +1658,8 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) : __table_(_VSTD::move(__u.__table_)) { + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); __get_db()->swap(this, &__u); #endif } @@ -1713,9 +1669,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( unordered_multiset&& __u, const allocator_type& __a) : __table_(_VSTD::move(__u.__table_), __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__a != __u.get_allocator()) { iterator __i = __u.begin(); @@ -1732,9 +1686,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list<value_type> __il) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); insert(__il.begin(), __il.end()); } @@ -1744,9 +1696,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const key_equal& __eql) : __table_(__hf, __eql) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } @@ -1757,9 +1707,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); __table_.rehash(__n); insert(__il.begin(), __il.end()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 0050fc4f8c..3d4d1eaff9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -376,11 +376,9 @@ public: _LIBCPP_INLINE_VISIBILITY vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - } + { + _VSTD::__debug_db_insert_c(this); + } _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a) #if _LIBCPP_STD_VER <= 14 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) @@ -389,9 +387,7 @@ public: #endif : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); } explicit vector(size_type __n); #if _LIBCPP_STD_VER > 11 @@ -403,9 +399,7 @@ public: vector(size_type __n, const value_type& __x, const allocator_type& __a) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__n > 0) { __vallocate(__n); @@ -1134,9 +1128,7 @@ vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__n > 0) { __vallocate(__n); @@ -1149,9 +1141,7 @@ template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__n > 0) { __vallocate(__n); @@ -1163,9 +1153,7 @@ vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__n > 0) { __vallocate(__n); @@ -1183,9 +1171,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, typename iterator_traits<_InputIterator>::reference>::value, _InputIterator>::type __last) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) __emplace_back(*__first); } @@ -1200,9 +1186,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c typename iterator_traits<_InputIterator>::reference>::value>::type*) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) __emplace_back(*__first); } @@ -1216,9 +1200,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, typename iterator_traits<_ForwardIterator>::reference>::value, _ForwardIterator>::type __last) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n > 0) { @@ -1236,9 +1218,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __las typename iterator_traits<_ForwardIterator>::reference>::value>::type*) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n > 0) { @@ -1251,9 +1231,7 @@ template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(const vector& __x) : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc())) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); size_type __n = __x.size(); if (__n > 0) { @@ -1266,9 +1244,7 @@ template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(const vector& __x, const __identity_t<allocator_type>& __a) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); size_type __n = __x.size(); if (__n > 0) { @@ -1289,8 +1265,8 @@ vector<_Tp, _Allocator>::vector(vector&& __x) #endif : __base(_VSTD::move(__x.__alloc())) { + _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); __get_db()->swap(this, _VSTD::addressof(__x)); #endif this->__begin_ = __x.__begin_; @@ -1304,9 +1280,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(vector&& __x, const __identity_t<allocator_type>& __a) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__a == __x.__alloc()) { this->__begin_ = __x.__begin_; @@ -1328,9 +1302,7 @@ template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__il.size() > 0) { __vallocate(__il.size()); @@ -1343,9 +1315,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) : __base(__a) { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif + _VSTD::__debug_db_insert_c(this); if (__il.size() > 0) { __vallocate(__il.size()); diff --git a/contrib/libs/cxxsupp/libcxx/src/random.cpp b/contrib/libs/cxxsupp/libcxx/src/random.cpp index a5ac325bdf..5d3da335e4 100644 --- a/contrib/libs/cxxsupp/libcxx/src/random.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/random.cpp @@ -68,10 +68,8 @@ random_device::operator()() #elif defined(_LIBCPP_USING_ARC4_RANDOM) -random_device::random_device(const string& __token) +random_device::random_device(const string&) { - if (__token != "/dev/urandom") - __throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); } random_device::~random_device() |