diff options
author | AlexSm <alex@ydb.tech> | 2023-12-27 23:31:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 23:31:58 +0100 |
commit | d67bfb4b4b7549081543e87a31bc6cb5c46ac973 (patch) | |
tree | 8674f2f1570877cb653e7ddcff37ba00288de15a /contrib/libs/cxxsupp/libcxxmsvc/include | |
parent | 1f6bef05ed441c3aa2d565ac792b26cded704ac7 (diff) | |
download | ydb-d67bfb4b4b7549081543e87a31bc6cb5c46ac973.tar.gz |
Import libs 4 (#758)
Diffstat (limited to 'contrib/libs/cxxsupp/libcxxmsvc/include')
55 files changed, 32 insertions, 19161 deletions
diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h deleted file mode 100644 index 4bf3237892..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_handle.h +++ /dev/null @@ -1,202 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___COROUTINE_COROUTINE_HANDLE_H -#define _LIBCPP___COROUTINE_COROUTINE_HANDLE_H - -#include <__assert> -#include <__config> -#include <__functional/hash.h> -#include <__memory/addressof.h> -#include <compare> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -_LIBCPP_BEGIN_NAMESPACE_STD - -// [coroutine.handle] -template <class _Promise = void> -struct _LIBCPP_TEMPLATE_VIS coroutine_handle; - -template <> -struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> { -public: - // [coroutine.handle.con], construct/reset - _LIBCPP_HIDE_FROM_ABI - constexpr coroutine_handle() noexcept = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr coroutine_handle(nullptr_t) noexcept {} - - _LIBCPP_HIDE_FROM_ABI - coroutine_handle& operator=(nullptr_t) noexcept { - __handle_ = nullptr; - return *this; - } - - // [coroutine.handle.export.import], export/import - _LIBCPP_HIDE_FROM_ABI - constexpr void* address() const noexcept { return __handle_; } - - _LIBCPP_HIDE_FROM_ABI - static constexpr coroutine_handle from_address(void* __addr) noexcept { - coroutine_handle __tmp; - __tmp.__handle_ = __addr; - return __tmp; - } - - // [coroutine.handle.observers], observers - _LIBCPP_HIDE_FROM_ABI - constexpr explicit operator bool() const noexcept { - return __handle_ != nullptr; - } - - _LIBCPP_HIDE_FROM_ABI - bool done() const { - _LIBCPP_ASSERT(__is_suspended(), "done() can be called only on suspended coroutines"); - return __builtin_coro_done(__handle_); - } - - // [coroutine.handle.resumption], resumption - _LIBCPP_HIDE_FROM_ABI - void operator()() const { resume(); } - - _LIBCPP_HIDE_FROM_ABI - void resume() const { - _LIBCPP_ASSERT(__is_suspended(), "resume() can be called only on suspended coroutines"); - _LIBCPP_ASSERT(!done(), "resume() has undefined behavior when the coroutine is done"); - __builtin_coro_resume(__handle_); - } - - _LIBCPP_HIDE_FROM_ABI - void destroy() const { - _LIBCPP_ASSERT(__is_suspended(), "destroy() can be called only on suspended coroutines"); - __builtin_coro_destroy(__handle_); - } - -private: - bool __is_suspended() const { - // FIXME actually implement a check for if the coro is suspended. - return __handle_ != nullptr; - } - - void* __handle_ = nullptr; -}; - -// [coroutine.handle.compare] -inline _LIBCPP_HIDE_FROM_ABI -constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept { - return __x.address() == __y.address(); -} -inline _LIBCPP_HIDE_FROM_ABI -constexpr strong_ordering operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept { - return compare_three_way()(__x.address(), __y.address()); -} - -template <class _Promise> -struct _LIBCPP_TEMPLATE_VIS coroutine_handle { -public: - // [coroutine.handle.con], construct/reset - _LIBCPP_HIDE_FROM_ABI - constexpr coroutine_handle() noexcept = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr coroutine_handle(nullptr_t) noexcept {} - - _LIBCPP_HIDE_FROM_ABI - static coroutine_handle from_promise(_Promise& __promise) { - using _RawPromise = typename remove_cv<_Promise>::type; - coroutine_handle __tmp; - __tmp.__handle_ = - __builtin_coro_promise(_VSTD::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true); - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - coroutine_handle& operator=(nullptr_t) noexcept { - __handle_ = nullptr; - return *this; - } - - // [coroutine.handle.export.import], export/import - _LIBCPP_HIDE_FROM_ABI - constexpr void* address() const noexcept { return __handle_; } - - _LIBCPP_HIDE_FROM_ABI - static constexpr coroutine_handle from_address(void* __addr) noexcept { - coroutine_handle __tmp; - __tmp.__handle_ = __addr; - return __tmp; - } - - // [coroutine.handle.conv], conversion - _LIBCPP_HIDE_FROM_ABI - constexpr operator coroutine_handle<>() const noexcept { - return coroutine_handle<>::from_address(address()); - } - - // [coroutine.handle.observers], observers - _LIBCPP_HIDE_FROM_ABI - constexpr explicit operator bool() const noexcept { - return __handle_ != nullptr; - } - - _LIBCPP_HIDE_FROM_ABI - bool done() const { - _LIBCPP_ASSERT(__is_suspended(), "done() can be called only on suspended coroutines"); - return __builtin_coro_done(__handle_); - } - - // [coroutine.handle.resumption], resumption - _LIBCPP_HIDE_FROM_ABI - void operator()() const { resume(); } - - _LIBCPP_HIDE_FROM_ABI - void resume() const { - _LIBCPP_ASSERT(__is_suspended(), "resume() can be called only on suspended coroutines"); - _LIBCPP_ASSERT(!done(), "resume() has undefined behavior when the coroutine is done"); - __builtin_coro_resume(__handle_); - } - - _LIBCPP_HIDE_FROM_ABI - void destroy() const { - _LIBCPP_ASSERT(__is_suspended(), "destroy() can be called only on suspended coroutines"); - __builtin_coro_destroy(__handle_); - } - - // [coroutine.handle.promise], promise access - _LIBCPP_HIDE_FROM_ABI - _Promise& promise() const { - return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false)); - } - -private: - bool __is_suspended() const { - // FIXME actually implement a check for if the coro is suspended. - return __handle_ != nullptr; - } - void* __handle_ = nullptr; -}; - -// [coroutine.handle.hash] -template <class _Tp> -struct hash<coroutine_handle<_Tp>> { - _LIBCPP_HIDE_FROM_ABI - size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept { return hash<void*>()(__v.address()); } -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -#endif // _LIBCPP___COROUTINE_COROUTINE_HANDLE_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h deleted file mode 100644 index 0a5229b459..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/coroutine_traits.h +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___COROUTINE_COROUTINE_TRAITS_H -#define _LIBCPP___COROUTINE_COROUTINE_TRAITS_H - -#include <__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -_LIBCPP_BEGIN_NAMESPACE_STD - -// [coroutine.traits] -// [coroutine.traits.primary] -// The header <coroutine> defined the primary template coroutine_traits such that -// if ArgTypes is a parameter pack of types and if the qualified-id R::promise_type -// is valid and denotes a type ([temp.deduct]), then coroutine_traits<R, ArgTypes...> -// has the following publicly accessible memebr: -// -// using promise_type = typename R::promise_type; -// -// Otherwise, coroutine_traits<R, ArgTypes...> has no members. -template <class _Tp, class = void> -struct __coroutine_traits_sfinae {}; - -template <class _Tp> -struct __coroutine_traits_sfinae< - _Tp, typename __void_t<typename _Tp::promise_type>::type> -{ - using promise_type = typename _Tp::promise_type; -}; - -template <class _Ret, class... _Args> -struct coroutine_traits - : public __coroutine_traits_sfinae<_Ret> -{ -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -#endif // _LIBCPP___COROUTINE_COROUTINE_TRAITS_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h deleted file mode 100644 index 7a2c672057..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/noop_coroutine_handle.h +++ /dev/null @@ -1,112 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___COROUTINE_NOOP_COROUTINE_HANDLE_H -#define _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H - -#include <__config> -#include <__coroutine/coroutine_handle.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC) - -// [coroutine.noop] -// [coroutine.promise.noop] -struct noop_coroutine_promise {}; - -// [coroutine.handle.noop] -template <> -struct _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise> { -public: - // [coroutine.handle.noop.conv], conversion - _LIBCPP_HIDE_FROM_ABI - constexpr operator coroutine_handle<>() const noexcept { - return coroutine_handle<>::from_address(address()); - } - - // [coroutine.handle.noop.observers], observers - _LIBCPP_HIDE_FROM_ABI - constexpr explicit operator bool() const noexcept { return true; } - _LIBCPP_HIDE_FROM_ABI - constexpr bool done() const noexcept { return false; } - - // [coroutine.handle.noop.resumption], resumption - _LIBCPP_HIDE_FROM_ABI - constexpr void operator()() const noexcept {} - _LIBCPP_HIDE_FROM_ABI - constexpr void resume() const noexcept {} - _LIBCPP_HIDE_FROM_ABI - constexpr void destroy() const noexcept {} - - // [coroutine.handle.noop.promise], promise access - _LIBCPP_HIDE_FROM_ABI - noop_coroutine_promise& promise() const noexcept { - return *static_cast<noop_coroutine_promise*>( - __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false)); - } - - // [coroutine.handle.noop.address], address - _LIBCPP_HIDE_FROM_ABI - constexpr void* address() const noexcept { return __handle_; } - -private: - _LIBCPP_HIDE_FROM_ABI - friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept; - -#if __has_builtin(__builtin_coro_noop) - _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept { - this->__handle_ = __builtin_coro_noop(); - } - - void* __handle_ = nullptr; - -#elif defined(_LIBCPP_COMPILER_GCC) - // GCC doesn't implement __builtin_coro_noop(). - // Construct the coroutine frame manually instead. - struct __noop_coroutine_frame_ty_ { - static void __dummy_resume_destroy_func() { } - - void (*__resume_)() = __dummy_resume_destroy_func; - void (*__destroy_)() = __dummy_resume_destroy_func; - struct noop_coroutine_promise __promise_; - }; - - static __noop_coroutine_frame_ty_ __noop_coroutine_frame_; - - void* __handle_ = &__noop_coroutine_frame_; - - _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default; - -#endif // __has_builtin(__builtin_coro_noop) -}; - -using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>; - -#if defined(_LIBCPP_COMPILER_GCC) -inline noop_coroutine_handle::__noop_coroutine_frame_ty_ - noop_coroutine_handle::__noop_coroutine_frame_{}; -#endif - -// [coroutine.noop.coroutine] -inline _LIBCPP_HIDE_FROM_ABI -noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); } - -#endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC) - -_LIBCPP_END_NAMESPACE_STD - -#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -#endif // _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h deleted file mode 100644 index 31399ab29a..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__coroutine/trivial_awaitables.h +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___COROUTINE_TRIVIAL_AWAITABLES_H -#define __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H - -#include <__config> -#include <__coroutine/coroutine_handle.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -_LIBCPP_BEGIN_NAMESPACE_STD - -// [coroutine.trivial.awaitables] -struct suspend_never { - _LIBCPP_HIDE_FROM_ABI - constexpr bool await_ready() const noexcept { return true; } - _LIBCPP_HIDE_FROM_ABI - constexpr void await_suspend(coroutine_handle<>) const noexcept {} - _LIBCPP_HIDE_FROM_ABI - constexpr void await_resume() const noexcept {} -}; - -struct suspend_always { - _LIBCPP_HIDE_FROM_ABI - constexpr bool await_ready() const noexcept { return false; } - _LIBCPP_HIDE_FROM_ABI - constexpr void await_suspend(coroutine_handle<>) const noexcept {} - _LIBCPP_HIDE_FROM_ABI - constexpr void await_resume() const noexcept {} -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // __LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) - -#endif // __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h index 6ffb2ab806..79637f3fbf 100644 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h +++ b/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h @@ -401,10 +401,11 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits }; #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) -template<class _Tp> + #if !defined(_LIBCPP_HAS_NO_CONCEPTS) + +template<class _Tp> requires is_object_v<_Tp> -#endif struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> { typedef ptrdiff_t difference_type; @@ -417,6 +418,30 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> #endif }; +#else // !defined(_LIBCPP_HAS_NO_CONCEPTS) + +template <class _Tp, bool is_pointer_to_object> +struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer +{ + typedef ptrdiff_t difference_type; + typedef typename remove_cv<_Tp>::type value_type; + typedef _Tp* pointer; + typedef _Tp& reference; + typedef random_access_iterator_tag iterator_category; +#if _LIBCPP_STD_VER > 17 + typedef contiguous_iterator_tag iterator_concept; +#endif +}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer<_Tp, false> {}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> : public __iterator_traits_pointer<_Tp, is_object_v<_Tp>> {}; + +#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) + + template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value> struct __has_iterator_category_convertible_to : is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up> diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h deleted file mode 100644 index 77396222d6..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/all.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- 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_ALL_H -#define _LIBCPP___RANGES_ALL_H - -#include <__config> -#include <__iterator/concepts.h> -#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 <__utility/auto_cast.h> -#include <__utility/declval.h> -#include <__utility/forward.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges::views { - -namespace __all { - struct __fn : __range_adaptor_closure<__fn> { - template<class _Tp> - requires ranges::view<decay_t<_Tp>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) - { - return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)); - } - - template<class _Tp> - requires (!ranges::view<decay_t<_Tp>>) && - requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) - { - return ranges::ref_view{std::forward<_Tp>(__t)}; - } - - template<class _Tp> - requires (!ranges::view<decay_t<_Tp>> && - !requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } && - requires (_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; }) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) - { - return ranges::owning_view{std::forward<_Tp>(__t)}; - } - }; -} // namespace __all - -inline namespace __cpo { - inline constexpr auto all = __all::__fn{}; -} // namespace __cpo - -template<ranges::viewable_range _Range> -using all_t = decltype(views::all(declval<_Range>())); - -} // namespace ranges::views - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_ALL_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h deleted file mode 100644 index 78911284bb..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/common_view.h +++ /dev/null @@ -1,135 +0,0 @@ -// -*- 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_COMMON_VIEW_H -#define _LIBCPP___RANGES_COMMON_VIEW_H - -#include <__config> -#include <__iterator/common_iterator.h> -#include <__iterator/iterator_traits.h> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/concepts.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/range_adaptor.h> -#include <__ranges/size.h> -#include <__ranges/view_interface.h> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <concepts> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - -template<view _View> - requires (!common_range<_View> && copyable<iterator_t<_View>>) -class common_view : public view_interface<common_view<_View>> { - _View __base_ = _View(); - -public: - _LIBCPP_HIDE_FROM_ABI - common_view() requires default_initializable<_View> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit common_view(_View __v) : __base_(std::move(__v)) { } - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return std::move(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() { - if constexpr (random_access_range<_View> && sized_range<_View>) - return ranges::begin(__base_); - else - return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::begin(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() const requires range<const _View> { - if constexpr (random_access_range<const _View> && sized_range<const _View>) - return ranges::begin(__base_); - else - return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() { - if constexpr (random_access_range<_View> && sized_range<_View>) - return ranges::begin(__base_) + ranges::size(__base_); - else - return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::end(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() const requires range<const _View> { - if constexpr (random_access_range<const _View> && sized_range<const _View>) - return ranges::begin(__base_) + ranges::size(__base_); - else - return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::end(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() requires sized_range<_View> { - return ranges::size(__base_); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const requires sized_range<const _View> { - return ranges::size(__base_); - } -}; - -template<class _Range> -common_view(_Range&&) - -> common_view<views::all_t<_Range>>; - -template<class _View> -inline constexpr bool enable_borrowed_range<common_view<_View>> = enable_borrowed_range<_View>; - -namespace views { -namespace __common { - struct __fn : __range_adaptor_closure<__fn> { - template<class _Range> - requires common_range<_Range> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(views::all(std::forward<_Range>(__range)))) - -> decltype( views::all(std::forward<_Range>(__range))) - { return views::all(std::forward<_Range>(__range)); } - - template<class _Range> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(common_view{std::forward<_Range>(__range)})) - -> decltype( common_view{std::forward<_Range>(__range)}) - { return common_view{std::forward<_Range>(__range)}; } - }; -} // namespace __common - -inline namespace __cpo { - inline constexpr auto common = __common::__fn{}; -} // namespace __cpo -} // namespace views -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_COMMON_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h deleted file mode 100644 index e1c08a7ea1..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/copyable_box.h +++ /dev/null @@ -1,178 +0,0 @@ -// -*- 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_COPYABLE_BOX_H -#define _LIBCPP___RANGES_COPYABLE_BOX_H - -#include <__config> -#include <__memory/addressof.h> -#include <__memory/construct_at.h> -#include <__utility/move.h> -#include <concepts> -#include <optional> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -// __copyable_box allows turning a type that is copy-constructible (but maybe not copy-assignable) into -// a type that is both copy-constructible and copy-assignable. It does that by introducing an empty state -// and basically doing destroy-then-copy-construct in the assignment operator. The empty state is necessary -// to handle the case where the copy construction fails after destroying the object. -// -// In some cases, we can completely avoid the use of an empty state; we provide a specialization of -// __copyable_box that does this, see below for the details. - -template<class _Tp> -concept __copy_constructible_object = copy_constructible<_Tp> && is_object_v<_Tp>; - -namespace ranges { - // Primary template - uses std::optional and introduces an empty state in case assignment fails. - template<__copy_constructible_object _Tp> - class __copyable_box { - _LIBCPP_NO_UNIQUE_ADDRESS optional<_Tp> __val_; - - public: - template<class ..._Args> - requires is_constructible_v<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __copyable_box(in_place_t, _Args&& ...__args) - noexcept(is_nothrow_constructible_v<_Tp, _Args...>) - : __val_(in_place, std::forward<_Args>(__args)...) - { } - - _LIBCPP_HIDE_FROM_ABI - constexpr __copyable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) - requires default_initializable<_Tp> - : __val_(in_place) - { } - - _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box const&) = default; - _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box&&) = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr __copyable_box& operator=(__copyable_box const& __other) - noexcept(is_nothrow_copy_constructible_v<_Tp>) - { - if (this != std::addressof(__other)) { - if (__other.__has_value()) __val_.emplace(*__other); - else __val_.reset(); - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - __copyable_box& operator=(__copyable_box&&) requires movable<_Tp> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr __copyable_box& operator=(__copyable_box&& __other) - noexcept(is_nothrow_move_constructible_v<_Tp>) - { - if (this != std::addressof(__other)) { - if (__other.__has_value()) __val_.emplace(std::move(*__other)); - else __val_.reset(); - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return *__val_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return *__val_; } - - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp *operator->() const noexcept { return __val_.operator->(); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp *operator->() noexcept { return __val_.operator->(); } - - _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return __val_.has_value(); } - }; - - // This partial specialization implements an optimization for when we know we don't need to store - // an empty state to represent failure to perform an assignment. For copy-assignment, this happens: - // - // 1. If the type is copyable (which includes copy-assignment), we can use the type's own assignment operator - // directly and avoid using std::optional. - // 2. If the type is not copyable, but it is nothrow-copy-constructible, then we can implement assignment as - // destroy-and-then-construct and we know it will never fail, so we don't need an empty state. - // - // The exact same reasoning can be applied for move-assignment, with copyable replaced by movable and - // nothrow-copy-constructible replaced by nothrow-move-constructible. This specialization is enabled - // whenever we can apply any of these optimizations for both the copy assignment and the move assignment - // operator. - template<class _Tp> - concept __doesnt_need_empty_state_for_copy = copyable<_Tp> || is_nothrow_copy_constructible_v<_Tp>; - - template<class _Tp> - concept __doesnt_need_empty_state_for_move = movable<_Tp> || is_nothrow_move_constructible_v<_Tp>; - - template<__copy_constructible_object _Tp> - requires __doesnt_need_empty_state_for_copy<_Tp> && __doesnt_need_empty_state_for_move<_Tp> - class __copyable_box<_Tp> { - _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_; - - public: - template<class ..._Args> - requires is_constructible_v<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __copyable_box(in_place_t, _Args&& ...__args) - noexcept(is_nothrow_constructible_v<_Tp, _Args...>) - : __val_(std::forward<_Args>(__args)...) - { } - - _LIBCPP_HIDE_FROM_ABI - constexpr __copyable_box() noexcept(is_nothrow_default_constructible_v<_Tp>) - requires default_initializable<_Tp> - : __val_() - { } - - _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box const&) = default; - _LIBCPP_HIDE_FROM_ABI __copyable_box(__copyable_box&&) = default; - - // Implementation of assignment operators in case we perform optimization (1) - _LIBCPP_HIDE_FROM_ABI __copyable_box& operator=(__copyable_box const&) requires copyable<_Tp> = default; - _LIBCPP_HIDE_FROM_ABI __copyable_box& operator=(__copyable_box&&) requires movable<_Tp> = default; - - // Implementation of assignment operators in case we perform optimization (2) - _LIBCPP_HIDE_FROM_ABI - constexpr __copyable_box& operator=(__copyable_box const& __other) noexcept { - static_assert(is_nothrow_copy_constructible_v<_Tp>); - if (this != std::addressof(__other)) { - std::destroy_at(std::addressof(__val_)); - std::construct_at(std::addressof(__val_), __other.__val_); - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __copyable_box& operator=(__copyable_box&& __other) noexcept { - static_assert(is_nothrow_move_constructible_v<_Tp>); - if (this != std::addressof(__other)) { - std::destroy_at(std::addressof(__val_)); - std::construct_at(std::addressof(__val_), std::move(__other.__val_)); - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __val_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __val_; } - - _LIBCPP_HIDE_FROM_ABI constexpr const _Tp *operator->() const noexcept { return std::addressof(__val_); } - _LIBCPP_HIDE_FROM_ABI constexpr _Tp *operator->() noexcept { return std::addressof(__val_); } - - _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return true; } - }; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_COPYABLE_BOX_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h deleted file mode 100644 index 0a2d828578..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/counted.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- 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_COUNTED_H -#define _LIBCPP___RANGES_COUNTED_H - -#include <__concepts/convertible_to.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/counted_iterator.h> -#include <__iterator/default_sentinel.h> -#include <__iterator/incrementable_traits.h> -#include <__iterator/iterator_traits.h> -#include <__memory/pointer_traits.h> -#include <__ranges/subrange.h> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <span> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges::views { - -namespace __counted { - - struct __fn { - template<contiguous_iterator _It> - _LIBCPP_HIDE_FROM_ABI - static constexpr auto __go(_It __it, iter_difference_t<_It> __count) - noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count)))) - // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly - { return span(std::to_address(__it), static_cast<size_t>(__count)); } - - template<random_access_iterator _It> - _LIBCPP_HIDE_FROM_ABI - static constexpr auto __go(_It __it, iter_difference_t<_It> __count) - noexcept(noexcept(subrange(__it, __it + __count))) - -> decltype( subrange(__it, __it + __count)) - { return subrange(__it, __it + __count); } - - template<class _It> - _LIBCPP_HIDE_FROM_ABI - static constexpr auto __go(_It __it, iter_difference_t<_It> __count) - noexcept(noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel))) - -> decltype( subrange(counted_iterator(std::move(__it), __count), default_sentinel)) - { return subrange(counted_iterator(std::move(__it), __count), default_sentinel); } - - template<class _It, convertible_to<iter_difference_t<_It>> _Diff> - requires input_or_output_iterator<decay_t<_It>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_It&& __it, _Diff&& __count) const - noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count)))) - -> decltype( __go(std::forward<_It>(__it), std::forward<_Diff>(__count))) - { return __go(std::forward<_It>(__it), std::forward<_Diff>(__count)); } - }; - -} // namespace __counted - -inline namespace __cpo { - inline constexpr auto counted = __counted::__fn{}; -} // namespace __cpo - -} // namespace ranges::views - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_COUNTED_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h deleted file mode 100644 index 079a74d4b8..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/drop_view.h +++ /dev/null @@ -1,127 +0,0 @@ -// -*- 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_DROP_VIEW_H -#define _LIBCPP___RANGES_DROP_VIEW_H - -#include <__assert> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/iterator_traits.h> -#include <__iterator/next.h> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/concepts.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/non_propagating_cache.h> -#include <__ranges/size.h> -#include <__ranges/view_interface.h> -#include <__utility/move.h> -#include <concepts> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<view _View> - class drop_view - : public view_interface<drop_view<_View>> - { - // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an - // amortized O(1) begin() method. If this is an input_range, then we cannot cache - // begin because begin is not equality preserving. - // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because - // 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>; - _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); - range_difference_t<_View> __count_ = 0; - _View __base_ = _View(); - -public: - drop_view() requires default_initializable<_View> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr drop_view(_View __base, range_difference_t<_View> __count) - : __count_(__count) - , __base_(std::move(__base)) - { - _LIBCPP_ASSERT(__count_ >= 0, "count must be greater than or equal to zero."); - } - - _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() - requires (!(__simple_view<_View> && - random_access_range<const _View> && sized_range<const _View>)) - { - if constexpr (_UseCache) - if (__cached_begin_.__has_value()) - return *__cached_begin_; - - auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_)); - if constexpr (_UseCache) - __cached_begin_.__emplace(__tmp); - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() const - requires random_access_range<const _View> && sized_range<const _View> - { - return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() - requires (!__simple_view<_View>) - { return ranges::end(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() const - requires range<const _View> - { return ranges::end(__base_); } - - _LIBCPP_HIDE_FROM_ABI - static constexpr auto __size(auto& __self) { - const auto __s = ranges::size(__self.__base_); - const auto __c = static_cast<decltype(__s)>(__self.__count_); - return __s < __c ? 0 : __s - __c; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() - requires sized_range<_View> - { return __size(*this); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const - requires sized_range<const _View> - { return __size(*this); } - }; - - template<class _Range> - drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>; - - template<class _Tp> - inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_DROP_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h deleted file mode 100644 index c0b55b221a..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- 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_EMPTY_H -#define _LIBCPP___RANGES_EMPTY_H - -#include <__concepts/class_or_enum.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__ranges/access.h> -#include <__ranges/size.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -// [range.prim.empty] - -namespace ranges { -namespace __empty { - template <class _Tp> - concept __member_empty = - __workaround_52970<_Tp> && - requires(_Tp&& __t) { - bool(__t.empty()); - }; - - template<class _Tp> - concept __can_invoke_size = - !__member_empty<_Tp> && - requires(_Tp&& __t) { ranges::size(__t); }; - - template <class _Tp> - concept __can_compare_begin_end = - !__member_empty<_Tp> && - !__can_invoke_size<_Tp> && - requires(_Tp&& __t) { - bool(ranges::begin(__t) == ranges::end(__t)); - { ranges::begin(__t) } -> forward_iterator; - }; - - struct __fn { - template <__member_empty _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const - noexcept(noexcept(bool(__t.empty()))) { - return bool(__t.empty()); - } - - template <__can_invoke_size _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const - noexcept(noexcept(ranges::size(__t))) { - return ranges::size(__t) == 0; - } - - template<__can_compare_begin_end _Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const - noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) { - return ranges::begin(__t) == ranges::end(__t); - } - }; -} // namespace __empty - -inline namespace __cpo { - inline constexpr auto empty = __empty::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_EMPTY_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h deleted file mode 100644 index 6a08727678..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/empty_view.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- 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_EMPTY_VIEW_H -#define _LIBCPP___RANGES_EMPTY_VIEW_H - -#include <__config> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/view_interface.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<class _Tp> - requires is_object_v<_Tp> - class empty_view : public view_interface<empty_view<_Tp>> { - public: - _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; } - _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; } - _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; } - _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; } - _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; } - }; - - template<class _Tp> - inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_EMPTY_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h deleted file mode 100644 index b7c099e049..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/iota_view.h +++ /dev/null @@ -1,408 +0,0 @@ -// -*- 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_IOTA_VIEW_H -#define _LIBCPP___RANGES_IOTA_VIEW_H - -#include <__assert> -#include <__compare/three_way_comparable.h> -#include <__concepts/arithmetic.h> -#include <__concepts/constructible.h> -#include <__concepts/convertible_to.h> -#include <__concepts/copyable.h> -#include <__concepts/equality_comparable.h> -#include <__concepts/invocable.h> -#include <__concepts/same_as.h> -#include <__concepts/semiregular.h> -#include <__concepts/totally_ordered.h> -#include <__config> -#include <__functional/ranges_operations.h> -#include <__iterator/concepts.h> -#include <__iterator/incrementable_traits.h> -#include <__iterator/iterator_traits.h> -#include <__iterator/unreachable_sentinel.h> -#include <__ranges/copyable_box.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/view_interface.h> -#include <__utility/forward.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<class _Int> - struct __get_wider_signed { - static auto __call() { - if constexpr (sizeof(_Int) < sizeof(short)) return type_identity<short>{}; - else if constexpr (sizeof(_Int) < sizeof(int)) return type_identity<int>{}; - else if constexpr (sizeof(_Int) < sizeof(long)) return type_identity<long>{}; - else return type_identity<long long>{}; - - static_assert(sizeof(_Int) <= sizeof(long long), - "Found integer-like type that is bigger than largest integer like type."); - } - - using type = typename decltype(__call())::type; - }; - - template<class _Start> - using _IotaDiffT = typename _If< - (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)), - type_identity<iter_difference_t<_Start>>, - __get_wider_signed<_Start> - >::type; - - template<class _Iter> - concept __decrementable = incrementable<_Iter> && requires(_Iter __i) { - { --__i } -> same_as<_Iter&>; - { __i-- } -> same_as<_Iter>; - }; - - template<class _Iter> - concept __advanceable = - __decrementable<_Iter> && totally_ordered<_Iter> && - requires(_Iter __i, const _Iter __j, const _IotaDiffT<_Iter> __n) { - { __i += __n } -> same_as<_Iter&>; - { __i -= __n } -> same_as<_Iter&>; - _Iter(__j + __n); - _Iter(__n + __j); - _Iter(__j - __n); - { __j - __j } -> convertible_to<_IotaDiffT<_Iter>>; - }; - - template<class> - struct __iota_iterator_category {}; - - template<incrementable _Tp> - struct __iota_iterator_category<_Tp> { - using iterator_category = input_iterator_tag; - }; - - template<weakly_incrementable _Start, semiregular _Bound = unreachable_sentinel_t> - requires __weakly_equality_comparable_with<_Start, _Bound> && copyable<_Start> - class iota_view : public view_interface<iota_view<_Start, _Bound>> { - struct __iterator : public __iota_iterator_category<_Start> { - friend class iota_view; - - using iterator_concept = - _If<__advanceable<_Start>, random_access_iterator_tag, - _If<__decrementable<_Start>, bidirectional_iterator_tag, - _If<incrementable<_Start>, forward_iterator_tag, - /*Else*/ input_iterator_tag>>>; - - using value_type = _Start; - using difference_type = _IotaDiffT<_Start>; - - _Start __value_ = _Start(); - - _LIBCPP_HIDE_FROM_ABI - __iterator() requires default_initializable<_Start> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { - return __value_; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator++() { - ++__value_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr void operator++(int) { ++*this; } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator operator++(int) requires incrementable<_Start> { - auto __tmp = *this; - ++*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator--() requires __decrementable<_Start> { - --__value_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator operator--(int) requires __decrementable<_Start> { - auto __tmp = *this; - --*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator+=(difference_type __n) - requires __advanceable<_Start> - { - if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { - if (__n >= difference_type(0)) { - __value_ += static_cast<_Start>(__n); - } else { - __value_ -= static_cast<_Start>(-__n); - } - } else { - __value_ += __n; - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator-=(difference_type __n) - requires __advanceable<_Start> - { - if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { - if (__n >= difference_type(0)) { - __value_ -= static_cast<_Start>(__n); - } else { - __value_ += static_cast<_Start>(-__n); - } - } else { - __value_ -= __n; - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Start operator[](difference_type __n) const - requires __advanceable<_Start> - { - return _Start(__value_ + __n); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) - requires equality_comparable<_Start> - { - return __x.__value_ == __y.__value_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) - requires totally_ordered<_Start> - { - return __x.__value_ < __y.__value_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) - requires totally_ordered<_Start> - { - return __y < __x; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) - requires totally_ordered<_Start> - { - return !(__y < __x); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) - requires totally_ordered<_Start> - { - return !(__x < __y); - } - - friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) - requires totally_ordered<_Start> && three_way_comparable<_Start> - { - return __x.__value_ <=> __y.__value_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iterator operator+(__iterator __i, difference_type __n) - requires __advanceable<_Start> - { - __i += __n; - return __i; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iterator operator+(difference_type __n, __iterator __i) - requires __advanceable<_Start> - { - return __i + __n; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iterator operator-(__iterator __i, difference_type __n) - requires __advanceable<_Start> - { - __i -= __n; - return __i; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) - requires __advanceable<_Start> - { - if constexpr (__integer_like<_Start>) { - if constexpr (__signed_integer_like<_Start>) { - return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_)); - } - if (__y.__value_ > __x.__value_) { - return difference_type(-difference_type(__y.__value_ - __x.__value_)); - } - return difference_type(__x.__value_ - __y.__value_); - } - return __x.__value_ - __y.__value_; - } - }; - - struct __sentinel { - friend class iota_view; - - private: - _Bound __bound_ = _Bound(); - - public: - _LIBCPP_HIDE_FROM_ABI - __sentinel() = default; - constexpr explicit __sentinel(_Bound __bound) : __bound_(std::move(__bound)) {} - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { - return __x.__value_ == __y.__bound_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y) - requires sized_sentinel_for<_Bound, _Start> - { - return __x.__value_ - __y.__bound_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y) - requires sized_sentinel_for<_Bound, _Start> - { - return -(__y - __x); - } - }; - - _Start __value_ = _Start(); - _Bound __bound_ = _Bound(); - - public: - _LIBCPP_HIDE_FROM_ABI - iota_view() requires default_initializable<_Start> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { } - - _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(type_identity_t<_Start> __value, type_identity_t<_Bound> __bound) - : __value_(std::move(__value)), __bound_(std::move(__bound)) { - // Validate the precondition if possible. - if constexpr (totally_ordered_with<_Start, _Bound>) { - _LIBCPP_ASSERT(ranges::less_equal()(__value_, __bound_), - "Precondition violated: value is greater than bound."); - } - } - - _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(__iterator __first, __iterator __last) - requires same_as<_Start, _Bound> - : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(__iterator __first, _Bound __last) - requires same_as<_Bound, unreachable_sentinel_t> - : iota_view(std::move(__first.__value_), std::move(__last)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(__iterator __first, __sentinel __last) - requires (!same_as<_Start, _Bound> && !same_as<_Start, unreachable_sentinel_t>) - : iota_view(std::move(__first.__value_), std::move(__last.__bound_)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator begin() const { return __iterator{__value_}; } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() const { - if constexpr (same_as<_Bound, unreachable_sentinel_t>) - return unreachable_sentinel; - else - return __sentinel{__bound_}; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator end() const requires same_as<_Start, _Bound> { - return __iterator{__bound_}; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const - requires (same_as<_Start, _Bound> && __advanceable<_Start>) || - (integral<_Start> && integral<_Bound>) || - sized_sentinel_for<_Bound, _Start> - { - if constexpr (__integer_like<_Start> && __integer_like<_Bound>) { - if (__value_ < 0) { - if (__bound_ < 0) { - return std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_); - } - return std::__to_unsigned_like(__bound_) + std::__to_unsigned_like(-__value_); - } - return std::__to_unsigned_like(__bound_) - std::__to_unsigned_like(__value_); - } - return std::__to_unsigned_like(__bound_ - __value_); - } - }; - - template<class _Start, class _Bound> - requires (!__integer_like<_Start> || !__integer_like<_Bound> || - (__signed_integer_like<_Start> == __signed_integer_like<_Bound>)) - iota_view(_Start, _Bound) -> iota_view<_Start, _Bound>; - - template<class _Start, class _Bound> - inline constexpr bool enable_borrowed_range<iota_view<_Start, _Bound>> = true; - -namespace views { -namespace __iota { - struct __fn { - template<class _Start> - _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Start&& __start) const - noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start)))) - -> decltype( ranges::iota_view(std::forward<_Start>(__start))) - { return ranges::iota_view(std::forward<_Start>(__start)); } - - template<class _Start, class _Bound> - _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Start&& __start, _Bound&& __bound) const - noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)))) - -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound))) - { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)); } - }; -} // namespace __iota - -inline namespace __cpo { - inline constexpr auto iota = __iota::__fn{}; -} // namespace __cpo -} // namespace views -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_IOTA_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h deleted file mode 100644 index 395e5c7ece..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/join_view.h +++ /dev/null @@ -1,350 +0,0 @@ -// -*- 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_JOIN_VIEW_H -#define _LIBCPP___RANGES_JOIN_VIEW_H - -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/iterator_traits.h> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/concepts.h> -#include <__ranges/non_propagating_cache.h> -#include <__ranges/ref_view.h> -#include <__ranges/subrange.h> -#include <__ranges/view_interface.h> -#include <__utility/declval.h> -#include <__utility/forward.h> -#include <optional> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<class> - struct __join_view_iterator_category {}; - - template<class _View> - requires is_reference_v<range_reference_t<_View>> && - forward_range<_View> && - forward_range<range_reference_t<_View>> - struct __join_view_iterator_category<_View> { - using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category; - using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category; - - using iterator_category = _If< - derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag>, - bidirectional_iterator_tag, - _If< - derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>, - forward_iterator_tag, - input_iterator_tag - > - >; - }; - - template<input_range _View> - requires view<_View> && input_range<range_reference_t<_View>> - class join_view - : public view_interface<join_view<_View>> { - private: - using _InnerRange = range_reference_t<_View>; - - template<bool> struct __iterator; - template<bool> struct __sentinel; - - static constexpr bool _UseCache = !is_reference_v<_InnerRange>; - using _Cache = _If<_UseCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>; - _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cache_; - _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); - - public: - _LIBCPP_HIDE_FROM_ABI - join_view() requires default_initializable<_View> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit join_view(_View __base) - : __base_(std::move(__base)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return std::move(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() { - constexpr bool __use_const = __simple_view<_View> && - is_reference_v<range_reference_t<_View>>; - return __iterator<__use_const>{*this, ranges::begin(__base_)}; - } - - template<class _V2 = _View> - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() const - requires input_range<const _V2> && - is_reference_v<range_reference_t<const _V2>> - { - return __iterator<true>{*this, ranges::begin(__base_)}; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() { - if constexpr (forward_range<_View> && - is_reference_v<_InnerRange> && - forward_range<_InnerRange> && - common_range<_View> && - common_range<_InnerRange>) - return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)}; - else - return __sentinel<__simple_view<_View>>{*this}; - } - - template<class _V2 = _View> - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() const - requires input_range<const _V2> && - is_reference_v<range_reference_t<const _V2>> - { - using _ConstInnerRange = range_reference_t<const _View>; - if constexpr (forward_range<const _View> && - is_reference_v<_ConstInnerRange> && - forward_range<_ConstInnerRange> && - common_range<const _View> && - common_range<_ConstInnerRange>) { - return __iterator<true>{*this, ranges::end(__base_)}; - } else { - return __sentinel<true>{*this}; - } - } - }; - - template<input_range _View> - requires view<_View> && input_range<range_reference_t<_View>> - template<bool _Const> struct join_view<_View>::__sentinel { - template<bool> friend struct __sentinel; - - private: - using _Parent = __maybe_const<_Const, join_view>; - using _Base = __maybe_const<_Const, _View>; - sentinel_t<_Base> __end_ = sentinel_t<_Base>(); - - public: - _LIBCPP_HIDE_FROM_ABI - __sentinel() = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __sentinel(_Parent& __parent) - : __end_(ranges::end(__parent.__base_)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr __sentinel(__sentinel<!_Const> __s) - requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> - : __end_(std::move(__s.__end_)) {} - - template<bool _OtherConst> - requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { - return __x.__outer_ == __y.__end_; - } - }; - - template<input_range _View> - requires view<_View> && input_range<range_reference_t<_View>> - template<bool _Const> struct join_view<_View>::__iterator - : public __join_view_iterator_category<__maybe_const<_Const, _View>> { - - template<bool> friend struct __iterator; - - private: - using _Parent = __maybe_const<_Const, join_view>; - using _Base = __maybe_const<_Const, _View>; - using _Outer = iterator_t<_Base>; - using _Inner = iterator_t<range_reference_t<_Base>>; - - static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>; - - public: - _Outer __outer_ = _Outer(); - - private: - optional<_Inner> __inner_; - _Parent *__parent_ = nullptr; - - _LIBCPP_HIDE_FROM_ABI - constexpr void __satisfy() { - for (; __outer_ != ranges::end(__parent_->__base_); ++__outer_) { - auto&& __inner = [&]() -> auto&& { - if constexpr (__ref_is_glvalue) - return *__outer_; - else - return __parent_->__cache_.__emplace_from([&]() -> decltype(auto) { return *__outer_; }); - }(); - __inner_ = ranges::begin(__inner); - if (*__inner_ != ranges::end(__inner)) - return; - } - - if constexpr (__ref_is_glvalue) - __inner_.reset(); - } - - public: - using iterator_concept = _If< - __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>>, - bidirectional_iterator_tag, - _If< - __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>, - forward_iterator_tag, - input_iterator_tag - > - >; - - using value_type = range_value_t<range_reference_t<_Base>>; - - using difference_type = common_type_t< - range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>; - - _LIBCPP_HIDE_FROM_ABI - __iterator() requires default_initializable<_Outer> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator(_Parent& __parent, _Outer __outer) - : __outer_(std::move(__outer)) - , __parent_(std::addressof(__parent)) { - __satisfy(); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator(__iterator<!_Const> __i) - requires _Const && - convertible_to<iterator_t<_View>, _Outer> && - convertible_to<iterator_t<_InnerRange>, _Inner> - : __outer_(std::move(__i.__outer_)) - , __inner_(std::move(__i.__inner_)) - , __parent_(__i.__parent_) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) operator*() const { - return **__inner_; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Inner operator->() const - requires __has_arrow<_Inner> && copyable<_Inner> - { - return *__inner_; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator++() { - auto&& __inner = [&]() -> auto&& { - if constexpr (__ref_is_glvalue) - return *__outer_; - else - return *__parent_->__cache_; - }(); - if (++*__inner_ == ranges::end(__inner)) { - ++__outer_; - __satisfy(); - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr void operator++(int) { - ++*this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator operator++(int) - requires __ref_is_glvalue && - forward_range<_Base> && - forward_range<range_reference_t<_Base>> - { - auto __tmp = *this; - ++*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator--() - requires __ref_is_glvalue && - bidirectional_range<_Base> && - bidirectional_range<range_reference_t<_Base>> && - common_range<range_reference_t<_Base>> - { - if (__outer_ == ranges::end(__parent_->__base_)) - __inner_ = ranges::end(*--__outer_); - - // Skip empty inner ranges when going backwards. - while (*__inner_ == ranges::begin(*__outer_)) { - __inner_ = ranges::end(*--__outer_); - } - - --*__inner_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator operator--(int) - requires __ref_is_glvalue && - bidirectional_range<_Base> && - bidirectional_range<range_reference_t<_Base>> && - common_range<range_reference_t<_Base>> - { - auto __tmp = *this; - --*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) - requires __ref_is_glvalue && - equality_comparable<iterator_t<_Base>> && - equality_comparable<iterator_t<range_reference_t<_Base>>> - { - return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr decltype(auto) iter_move(const __iterator& __i) - noexcept(noexcept(ranges::iter_move(*__i.__inner_))) - { - return ranges::iter_move(*__i.__inner_); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y) - noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_))) - requires indirectly_swappable<_Inner> - { - return ranges::iter_swap(*__x.__inner_, *__y.__inner_); - } - }; - - template<class _Range> - explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>; - -} // namespace ranges - -#undef _CONSTEXPR_TERNARY - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_JOIN_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h deleted file mode 100644 index d9589ae46c..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/non_propagating_cache.h +++ /dev/null @@ -1,114 +0,0 @@ -// -*- 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_NON_PROPAGATING_CACHE_H -#define _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H - -#include <__config> -#include <__iterator/concepts.h> // indirectly_readable -#include <__iterator/iterator_traits.h> // iter_reference_t -#include <__memory/addressof.h> -#include <__utility/forward.h> -#include <concepts> // constructible_from -#include <optional> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - // __non_propagating_cache is a helper type that allows storing an optional value in it, - // but which does not copy the source's value when it is copy constructed/assigned to, - // and which resets the source's value when it is moved-from. - // - // This type is used as an implementation detail of some views that need to cache the - // result of `begin()` in order to provide an amortized O(1) begin() method. Typically, - // we don't want to propagate the value of the cache upon copy because the cached iterator - // may refer to internal details of the source view. - template<class _Tp> - requires is_object_v<_Tp> - class _LIBCPP_TEMPLATE_VIS __non_propagating_cache { - struct __from_tag { }; - struct __forward_tag { }; - - // This helper class is needed to perform copy and move elision when - // constructing the contained type from an iterator. - struct __wrapper { - template<class ..._Args> - constexpr explicit __wrapper(__forward_tag, _Args&& ...__args) : __t_(std::forward<_Args>(__args)...) { } - template<class _Fn> - constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) { } - _Tp __t_; - }; - - optional<__wrapper> __value_ = nullopt; - - public: - _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept - : __value_(nullopt) - { } - - _LIBCPP_HIDE_FROM_ABI - constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept - : __value_(nullopt) - { - __other.__value_.reset(); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept { - if (this != std::addressof(__other)) { - __value_.reset(); - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept { - __value_.reset(); - __other.__value_.reset(); - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp& operator*() { return __value_->__t_; } - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp const& operator*() const { return __value_->__t_; } - - _LIBCPP_HIDE_FROM_ABI - constexpr bool __has_value() const { return __value_.has_value(); } - - template<class _Fn> - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp& __emplace_from(_Fn const& __f) { - return __value_.emplace(__from_tag{}, __f).__t_; - } - - template<class ..._Args> - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp& __emplace(_Args&& ...__args) { - return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_; - } - }; - - struct __empty_cache { }; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_NON_PROPAGATING_CACHE_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h deleted file mode 100644 index 7987c60751..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/owning_view.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- 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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_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_(std::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 std::move(__r_); } - _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_OWNING_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h deleted file mode 100644 index 9c53488ba6..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/range_adaptor.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- 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_RANGE_ADAPTOR_H -#define _LIBCPP___RANGES_RANGE_ADAPTOR_H - -#include <__config> -#include <__functional/compose.h> -#include <__functional/invoke.h> -#include <__ranges/concepts.h> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <concepts> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -// CRTP base that one can derive from in order to be considered a range adaptor closure -// by the library. When deriving from this class, a pipe operator will be provided to -// make the following hold: -// - `x | f` is equivalent to `f(x)` -// - `f1 | f2` is an adaptor closure `g` such that `g(x)` is equivalent to `f2(f1(x))` -template <class _Tp> -struct __range_adaptor_closure; - -// Type that wraps an arbitrary function object and makes it into a range adaptor closure, -// i.e. something that can be called via the `x | f` notation. -template <class _Fn> -struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> { - constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) { } -}; - -template <class _Tp> -concept _RangeAdaptorClosure = derived_from<remove_cvref_t<_Tp>, __range_adaptor_closure<remove_cvref_t<_Tp>>>; - -template <class _Tp> -struct __range_adaptor_closure { - template <ranges::viewable_range _View, _RangeAdaptorClosure _Closure> - requires same_as<_Tp, remove_cvref_t<_Closure>> && - invocable<_Closure, _View> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - friend constexpr decltype(auto) operator|(_View&& __view, _Closure&& __closure) - noexcept(is_nothrow_invocable_v<_Closure, _View>) - { return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view)); } - - template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure> - requires same_as<_Tp, remove_cvref_t<_Closure>> && - constructible_from<decay_t<_Closure>, _Closure> && - constructible_from<decay_t<_OtherClosure>, _OtherClosure> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) - noexcept(is_nothrow_constructible_v<decay_t<_Closure>, _Closure> && - is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) - { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); } -}; - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_RANGE_ADAPTOR_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h deleted file mode 100644 index 20f5489c50..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rbegin.h +++ /dev/null @@ -1,130 +0,0 @@ -// -*- 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_RBEGIN_H -#define _LIBCPP___RANGES_RBEGIN_H - -#include <__concepts/class_or_enum.h> -#include <__concepts/same_as.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/readable_traits.h> -#include <__iterator/reverse_iterator.h> -#include <__ranges/access.h> -#include <__utility/auto_cast.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -// [ranges.access.rbegin] - -namespace ranges { -namespace __rbegin { -template <class _Tp> -concept __member_rbegin = - __can_borrow<_Tp> && - __workaround_52970<_Tp> && - requires(_Tp&& __t) { - { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator; - }; - -void rbegin(auto&) = delete; -void rbegin(const auto&) = delete; - -template <class _Tp> -concept __unqualified_rbegin = - !__member_rbegin<_Tp> && - __can_borrow<_Tp> && - __class_or_enum<remove_cvref_t<_Tp>> && - requires(_Tp&& __t) { - { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator; - }; - -template <class _Tp> -concept __can_reverse = - __can_borrow<_Tp> && - !__member_rbegin<_Tp> && - !__unqualified_rbegin<_Tp> && - requires(_Tp&& __t) { - { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>; - { ranges::begin(__t) } -> bidirectional_iterator; - }; - -struct __fn { - template <class _Tp> - requires __member_rbegin<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) - { - return _LIBCPP_AUTO_CAST(__t.rbegin()); - } - - template <class _Tp> - requires __unqualified_rbegin<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) - { - return _LIBCPP_AUTO_CAST(rbegin(__t)); - } - - template <class _Tp> - requires __can_reverse<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::end(__t))) - { - return std::make_reverse_iterator(ranges::end(__t)); - } - - void operator()(auto&&) const = delete; -}; -} // namespace __rbegin - -inline namespace __cpo { - inline constexpr auto rbegin = __rbegin::__fn{}; -} // namespace __cpo -} // namespace ranges - -// [range.access.crbegin] - -namespace ranges { -namespace __crbegin { -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::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)))) - -> decltype( ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))) - { return ranges::rbegin(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::rbegin(static_cast<const _Tp&&>(__t)))) - -> decltype( ranges::rbegin(static_cast<const _Tp&&>(__t))) - { return ranges::rbegin(static_cast<const _Tp&&>(__t)); } -}; -} // namespace __crbegin - -inline namespace __cpo { - inline constexpr auto crbegin = __crbegin::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_RBEGIN_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h deleted file mode 100644 index 255a468606..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/ref_view.h +++ /dev/null @@ -1,86 +0,0 @@ -// -*- 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_REF_VIEW_H -#define _LIBCPP___RANGES_REF_VIEW_H - -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/incrementable_traits.h> -#include <__iterator/iterator_traits.h> -#include <__memory/addressof.h> -#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/forward.h> -#include <concepts> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<range _Range> - requires is_object_v<_Range> - class ref_view : public view_interface<ref_view<_Range>> { - _Range *__range_; - - static void __fun(_Range&); - static void __fun(_Range&&) = delete; - -public: - template<class _Tp> - requires __different_from<_Tp, ref_view> && - convertible_to<_Tp, _Range&> && requires { __fun(declval<_Tp>()); } - _LIBCPP_HIDE_FROM_ABI - constexpr ref_view(_Tp&& __t) - : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) - {} - - _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; } - - _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); } - _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr bool empty() const - requires requires { ranges::empty(*__range_); } - { return ranges::empty(*__range_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const - requires sized_range<_Range> - { return ranges::size(*__range_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto data() const - requires contiguous_range<_Range> - { return ranges::data(*__range_); } - }; - - template<class _Range> - ref_view(_Range&) -> ref_view<_Range>; - - template<class _Tp> - inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_REF_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h deleted file mode 100644 index 4f1597e073..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/rend.h +++ /dev/null @@ -1,134 +0,0 @@ -// -*- 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_REND_H -#define _LIBCPP___RANGES_REND_H - -#include <__concepts/class_or_enum.h> -#include <__concepts/same_as.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/readable_traits.h> -#include <__iterator/reverse_iterator.h> -#include <__ranges/access.h> -#include <__ranges/rbegin.h> -#include <__utility/auto_cast.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -// [range.access.rend] - -namespace ranges { -namespace __rend { -template <class _Tp> -concept __member_rend = - __can_borrow<_Tp> && - __workaround_52970<_Tp> && - requires(_Tp&& __t) { - ranges::rbegin(__t); - { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>; - }; - -void rend(auto&) = delete; -void rend(const auto&) = delete; - -template <class _Tp> -concept __unqualified_rend = - !__member_rend<_Tp> && - __can_borrow<_Tp> && - __class_or_enum<remove_cvref_t<_Tp>> && - requires(_Tp&& __t) { - ranges::rbegin(__t); - { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>; - }; - -template <class _Tp> -concept __can_reverse = - __can_borrow<_Tp> && - !__member_rend<_Tp> && - !__unqualified_rend<_Tp> && - requires(_Tp&& __t) { - { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>; - { ranges::begin(__t) } -> bidirectional_iterator; - }; - -class __fn { -public: - template <class _Tp> - requires __member_rend<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) - { - return _LIBCPP_AUTO_CAST(__t.rend()); - } - - template <class _Tp> - requires __unqualified_rend<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) - { - return _LIBCPP_AUTO_CAST(rend(__t)); - } - - template <class _Tp> - requires __can_reverse<_Tp> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::begin(__t))) - { - return std::make_reverse_iterator(ranges::begin(__t)); - } - - void operator()(auto&&) const = delete; -}; -} // namespace __rend - -inline namespace __cpo { - inline constexpr auto rend = __rend::__fn{}; -} // namespace __cpo -} // namespace ranges - -// [range.access.crend] - -namespace ranges { -namespace __crend { -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::rend(static_cast<const remove_reference_t<_Tp>&>(__t)))) - -> decltype( ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))) - { return ranges::rend(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::rend(static_cast<const _Tp&&>(__t)))) - -> decltype( ranges::rend(static_cast<const _Tp&&>(__t))) - { return ranges::rend(static_cast<const _Tp&&>(__t)); } -}; -} // namespace __crend - -inline namespace __cpo { - inline constexpr auto crend = __crend::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_REND_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h deleted file mode 100644 index c3ab6261f0..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/reverse_view.h +++ /dev/null @@ -1,190 +0,0 @@ -// -*- 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_REVERSE_VIEW_H -#define _LIBCPP___RANGES_REVERSE_VIEW_H - -#include <__concepts/constructible.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/next.h> -#include <__iterator/reverse_iterator.h> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/concepts.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/non_propagating_cache.h> -#include <__ranges/range_adaptor.h> -#include <__ranges/size.h> -#include <__ranges/subrange.h> -#include <__ranges/view_interface.h> -#include <__utility/forward.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<view _View> - requires bidirectional_range<_View> - class reverse_view : public view_interface<reverse_view<_View>> { - // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an - // 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>; - _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); - _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); - - public: - _LIBCPP_HIDE_FROM_ABI - reverse_view() requires default_initializable<_View> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return std::move(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr reverse_iterator<iterator_t<_View>> begin() { - if constexpr (_UseCache) - if (__cached_begin_.__has_value()) - return *__cached_begin_; - - auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_))); - if constexpr (_UseCache) - __cached_begin_.__emplace(__tmp); - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr reverse_iterator<iterator_t<_View>> begin() requires common_range<_View> { - return std::make_reverse_iterator(ranges::end(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() const requires common_range<const _View> { - return std::make_reverse_iterator(ranges::end(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr reverse_iterator<iterator_t<_View>> end() { - return std::make_reverse_iterator(ranges::begin(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() const requires common_range<const _View> { - return std::make_reverse_iterator(ranges::begin(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() requires sized_range<_View> { - return ranges::size(__base_); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const requires sized_range<const _View> { - return ranges::size(__base_); - } - }; - - template<class _Range> - reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>; - - template<class _Tp> - inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>; - - namespace views { - namespace __reverse { - template<class _Tp> - constexpr bool __is_reverse_view = false; - - template<class _Tp> - constexpr bool __is_reverse_view<reverse_view<_Tp>> = true; - - template<class _Tp> - constexpr bool __is_sized_reverse_subrange = false; - - template<class _Iter> - constexpr bool __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> = true; - - template<class _Tp> - constexpr bool __is_unsized_reverse_subrange = false; - - template<class _Iter, subrange_kind _Kind> - constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> = _Kind == subrange_kind::unsized; - - template<class _Tp> - struct __unwrapped_reverse_subrange { - using type = void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics - }; - - template<class _Iter, subrange_kind _Kind> - struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> { - using type = subrange<_Iter, _Iter, _Kind>; - }; - - struct __fn : __range_adaptor_closure<__fn> { - template<class _Range> - requires __is_reverse_view<remove_cvref_t<_Range>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(std::forward<_Range>(__range).base())) - -> decltype( std::forward<_Range>(__range).base()) - { return std::forward<_Range>(__range).base(); } - - template<class _Range, - class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type> - requires __is_sized_reverse_subrange<remove_cvref_t<_Range>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()))) - -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())) - { return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()); } - - template<class _Range, - class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type> - requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base()))) - -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base())) - { return _UnwrappedSubrange(__range.end().base(), __range.begin().base()); } - - template<class _Range> - requires (!__is_reverse_view<remove_cvref_t<_Range>> && - !__is_sized_reverse_subrange<remove_cvref_t<_Range>> && - !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>) - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range) const - noexcept(noexcept(reverse_view{std::forward<_Range>(__range)})) - -> decltype( reverse_view{std::forward<_Range>(__range)}) - { return reverse_view{std::forward<_Range>(__range)}; } - }; - } // namespace __reverse - - inline namespace __cpo { - inline constexpr auto reverse = __reverse::__fn{}; - } // namespace __cpo - } // namespace views -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_REVERSE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h deleted file mode 100644 index e0fd4849f4..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/single_view.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- 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_SINGLE_VIEW_H -#define _LIBCPP___RANGES_SINGLE_VIEW_H - -#include <__config> -#include <__ranges/copyable_box.h> -#include <__ranges/view_interface.h> -#include <__utility/forward.h> -#include <__utility/in_place.h> -#include <__utility/move.h> -#include <concepts> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<copy_constructible _Tp> - requires is_object_v<_Tp> - class single_view : public view_interface<single_view<_Tp>> { - __copyable_box<_Tp> __value_; - - public: - _LIBCPP_HIDE_FROM_ABI - single_view() requires default_initializable<_Tp> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit single_view(const _Tp& __t) : __value_(in_place, __t) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit single_view(_Tp&& __t) : __value_(in_place, std::move(__t)) {} - - template<class... _Args> - requires constructible_from<_Tp, _Args...> - _LIBCPP_HIDE_FROM_ABI - constexpr explicit single_view(in_place_t, _Args&&... __args) - : __value_{in_place, std::forward<_Args>(__args)...} {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp* begin() noexcept { return data(); } - - _LIBCPP_HIDE_FROM_ABI - constexpr const _Tp* begin() const noexcept { return data(); } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp* end() noexcept { return data() + 1; } - - _LIBCPP_HIDE_FROM_ABI - constexpr const _Tp* end() const noexcept { return data() + 1; } - - _LIBCPP_HIDE_FROM_ABI - static constexpr size_t size() noexcept { return 1; } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Tp* data() noexcept { return __value_.operator->(); } - - _LIBCPP_HIDE_FROM_ABI - constexpr const _Tp* data() const noexcept { return __value_.operator->(); } - }; - - template<class _Tp> - single_view(_Tp) -> single_view<_Tp>; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_SINGLE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h deleted file mode 100644 index c54f7710fc..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/subrange.h +++ /dev/null @@ -1,289 +0,0 @@ -// -*- 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_SUBRANGE_H -#define _LIBCPP___RANGES_SUBRANGE_H - -#include <__assert> -#include <__concepts/constructible.h> -#include <__concepts/convertible_to.h> -#include <__concepts/copyable.h> -#include <__concepts/derived_from.h> -#include <__concepts/different_from.h> -#include <__config> -#include <__iterator/advance.h> -#include <__iterator/concepts.h> -#include <__iterator/incrementable_traits.h> -#include <__iterator/iterator_traits.h> -#include <__ranges/access.h> -#include <__ranges/concepts.h> -#include <__ranges/dangling.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/size.h> -#include <__ranges/view_interface.h> -#include <__tuple> -#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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<class _From, class _To> - concept __uses_nonqualification_pointer_conversion = - is_pointer_v<_From> && is_pointer_v<_To> && - !convertible_to<remove_pointer_t<_From>(*)[], remove_pointer_t<_To>(*)[]>; - - template<class _From, class _To> - concept __convertible_to_non_slicing = - convertible_to<_From, _To> && - !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>; - - template<class _Tp> - concept __pair_like = - !is_reference_v<_Tp> && requires(_Tp __t) { - typename tuple_size<_Tp>::type; // Ensures `tuple_size<T>` is complete. - requires derived_from<tuple_size<_Tp>, integral_constant<size_t, 2>>; - typename tuple_element_t<0, remove_const_t<_Tp>>; - typename tuple_element_t<1, remove_const_t<_Tp>>; - { std::get<0>(__t) } -> convertible_to<const tuple_element_t<0, _Tp>&>; - { std::get<1>(__t) } -> convertible_to<const tuple_element_t<1, _Tp>&>; - }; - - template<class _Pair, class _Iter, class _Sent> - concept __pair_like_convertible_from = - !range<_Pair> && __pair_like<_Pair> && - constructible_from<_Pair, _Iter, _Sent> && - __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> && - convertible_to<_Sent, tuple_element_t<1, _Pair>>; - - enum class _LIBCPP_ENUM_VIS subrange_kind : bool { unsized, sized }; - - template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent = _Iter, - subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> - ? subrange_kind::sized - : subrange_kind::unsized> - requires (_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>) - class _LIBCPP_TEMPLATE_VIS subrange - : public view_interface<subrange<_Iter, _Sent, _Kind>> - { - private: - static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>); - 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>; - _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 - subrange() requires default_initializable<_Iter> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent) - requires _MustProvideSizeAtConstruction - : __begin_(std::move(__iter)), __end_(std::move(__sent)) - { } - - _LIBCPP_HIDE_FROM_ABI - constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, - make_unsigned_t<iter_difference_t<_Iter>> __n) - requires (_Kind == subrange_kind::sized) - : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) - { - if constexpr (sized_sentinel_for<_Sent, _Iter>) - _LIBCPP_ASSERT((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n), - "std::ranges::subrange was passed an invalid size hint"); - } - - template<__different_from<subrange> _Range> - requires borrowed_range<_Range> && - __convertible_to_non_slicing<iterator_t<_Range>, _Iter> && - convertible_to<sentinel_t<_Range>, _Sent> - _LIBCPP_HIDE_FROM_ABI - constexpr subrange(_Range&& __range) - requires (!_StoreSize) - : subrange(ranges::begin(__range), ranges::end(__range)) - { } - - template<__different_from<subrange> _Range> - requires borrowed_range<_Range> && - __convertible_to_non_slicing<iterator_t<_Range>, _Iter> && - convertible_to<sentinel_t<_Range>, _Sent> - _LIBCPP_HIDE_FROM_ABI - constexpr subrange(_Range&& __range) - requires _StoreSize && sized_range<_Range> - : subrange(__range, ranges::size(__range)) - { } - - template<borrowed_range _Range> - requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> && - convertible_to<sentinel_t<_Range>, _Sent> - _LIBCPP_HIDE_FROM_ABI - constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n) - requires (_Kind == subrange_kind::sized) - : subrange(ranges::begin(__range), ranges::end(__range), __n) - { } - - template<__different_from<subrange> _Pair> - requires __pair_like_convertible_from<_Pair, const _Iter&, const _Sent&> - _LIBCPP_HIDE_FROM_ABI - constexpr operator _Pair() const { - return _Pair(__begin_, __end_); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Iter begin() const requires copyable<_Iter> { - return __begin_; - } - - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() requires (!copyable<_Iter>) { - return std::move(__begin_); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Sent end() const { - return __end_; - } - - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { - return __begin_ == __end_; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const - requires (_Kind == subrange_kind::sized) - { - if constexpr (_StoreSize) - return __size_; - else - return std::__to_unsigned_like(__end_ - __begin_); - } - - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const& - requires forward_iterator<_Iter> - { - auto __tmp = *this; - __tmp.advance(__n); - return __tmp; - } - - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && { - advance(__n); - return std::move(*this); - } - - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const - requires bidirectional_iterator<_Iter> - { - auto __tmp = *this; - __tmp.advance(-__n); - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr subrange& advance(iter_difference_t<_Iter> __n) { - if constexpr (bidirectional_iterator<_Iter>) { - if (__n < 0) { - ranges::advance(__begin_, __n); - if constexpr (_StoreSize) - __size_ += std::__to_unsigned_like(-__n); - return *this; - } - } - - auto __d = __n - ranges::advance(__begin_, __n, __end_); - if constexpr (_StoreSize) - __size_ -= std::__to_unsigned_like(__d); - return *this; - } - }; - - template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent> - subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>; - - template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent> - subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) - -> subrange<_Iter, _Sent, subrange_kind::sized>; - - template<borrowed_range _Range> - subrange(_Range&&) -> subrange<iterator_t<_Range>, sentinel_t<_Range>, - (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>) - ? subrange_kind::sized : subrange_kind::unsized>; - - template<borrowed_range _Range> - subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>) - -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>; - - template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> - requires ((_Index == 0 && copyable<_Iter>) || _Index == 1) - _LIBCPP_HIDE_FROM_ABI - constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) { - if constexpr (_Index == 0) - return __subrange.begin(); - else - return __subrange.end(); - } - - template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind> - requires (_Index < 2) - _LIBCPP_HIDE_FROM_ABI - constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) { - if constexpr (_Index == 0) - return __subrange.begin(); - else - return __subrange.end(); - } - - template<class _Ip, class _Sp, subrange_kind _Kp> - inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true; - - template<range _Rp> - using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>; -} // namespace ranges - -// [range.subrange.general] - -using ranges::get; - -// [ranges.syn] - -template<class _Ip, class _Sp, ranges::subrange_kind _Kp> -struct tuple_size<ranges::subrange<_Ip, _Sp, _Kp>> : integral_constant<size_t, 2> {}; - -template<class _Ip, class _Sp, ranges::subrange_kind _Kp> -struct tuple_element<0, ranges::subrange<_Ip, _Sp, _Kp>> { - using type = _Ip; -}; - -template<class _Ip, class _Sp, ranges::subrange_kind _Kp> -struct tuple_element<1, ranges::subrange<_Ip, _Sp, _Kp>> { - using type = _Sp; -}; - -template<class _Ip, class _Sp, ranges::subrange_kind _Kp> -struct tuple_element<0, const ranges::subrange<_Ip, _Sp, _Kp>> { - using type = _Ip; -}; - -template<class _Ip, class _Sp, ranges::subrange_kind _Kp> -struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> { - using type = _Sp; -}; - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_SUBRANGE_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h deleted file mode 100644 index b5f194f9a0..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/take_view.h +++ /dev/null @@ -1,185 +0,0 @@ -// -*- 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_TAKE_VIEW_H -#define _LIBCPP___RANGES_TAKE_VIEW_H - -#include <__algorithm/min.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/counted_iterator.h> -#include <__iterator/default_sentinel.h> -#include <__iterator/iterator_traits.h> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/concepts.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/size.h> -#include <__ranges/view_interface.h> -#include <__utility/move.h> -#include <concepts> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - template<view _View> - class take_view : public view_interface<take_view<_View>> { - _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); - range_difference_t<_View> __count_ = 0; - - template<bool> class __sentinel; - - public: - _LIBCPP_HIDE_FROM_ABI - take_view() requires default_initializable<_View> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr take_view(_View __base, range_difference_t<_View> __count) - : __base_(std::move(__base)), __count_(__count) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return std::move(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() requires (!__simple_view<_View>) { - if constexpr (sized_range<_View>) { - if constexpr (random_access_range<_View>) { - return ranges::begin(__base_); - } else { - using _DifferenceT = range_difference_t<_View>; - auto __size = size(); - return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size)); - } - } else { - return counted_iterator(ranges::begin(__base_), __count_); - } - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto begin() const requires range<const _View> { - if constexpr (sized_range<const _View>) { - if constexpr (random_access_range<const _View>) { - return ranges::begin(__base_); - } else { - using _DifferenceT = range_difference_t<const _View>; - auto __size = size(); - return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size)); - } - } else { - return counted_iterator(ranges::begin(__base_), __count_); - } - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() requires (!__simple_view<_View>) { - if constexpr (sized_range<_View>) { - if constexpr (random_access_range<_View>) { - return ranges::begin(__base_) + size(); - } else { - return default_sentinel; - } - } else { - return __sentinel<false>{ranges::end(__base_)}; - } - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto end() const requires range<const _View> { - if constexpr (sized_range<const _View>) { - if constexpr (random_access_range<const _View>) { - return ranges::begin(__base_) + size(); - } else { - return default_sentinel; - } - } else { - return __sentinel<true>{ranges::end(__base_)}; - } - } - - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() requires sized_range<_View> { - auto __n = ranges::size(__base_); - // TODO: use ranges::min here. - return std::min(__n, static_cast<decltype(__n)>(__count_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const requires sized_range<const _View> { - auto __n = ranges::size(__base_); - // TODO: use ranges::min here. - return std::min(__n, static_cast<decltype(__n)>(__count_)); - } - }; - - template<view _View> - template<bool _Const> - class take_view<_View>::__sentinel { - using _Base = __maybe_const<_Const, _View>; - template<bool _OtherConst> - using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>; - _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>(); - - template<bool> - friend class take_view<_View>::__sentinel; - -public: - _LIBCPP_HIDE_FROM_ABI - __sentinel() = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr __sentinel(__sentinel<!_Const> __s) - requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> - : __end_(std::move(__s.__end_)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr sentinel_t<_Base> base() const { return __end_; } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) { - return __lhs.count() == 0 || __lhs.base() == __rhs.__end_; - } - - template<bool _OtherConst = !_Const> - requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) { - return __lhs.count() == 0 || __lhs.base() == __rhs.__end_; - } - }; - - template<class _Range> - take_view(_Range&&, range_difference_t<_Range>) -> take_view<views::all_t<_Range>>; - - template<class _Tp> - inline constexpr bool enable_borrowed_range<take_view<_Tp>> = enable_borrowed_range<_Tp>; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___RANGES_TAKE_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h deleted file mode 100644 index 4cc582faeb..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/transform_view.h +++ /dev/null @@ -1,440 +0,0 @@ -// -*- 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_TRANSFORM_VIEW_H -#define _LIBCPP___RANGES_TRANSFORM_VIEW_H - -#include <__compare/three_way_comparable.h> -#include <__concepts/constructible.h> -#include <__concepts/convertible_to.h> -#include <__concepts/copyable.h> -#include <__concepts/derived_from.h> -#include <__concepts/equality_comparable.h> -#include <__concepts/invocable.h> -#include <__config> -#include <__functional/bind_back.h> -#include <__functional/invoke.h> -#include <__iterator/concepts.h> -#include <__iterator/iterator_traits.h> -#include <__memory/addressof.h> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/concepts.h> -#include <__ranges/copyable_box.h> -#include <__ranges/empty.h> -#include <__ranges/range_adaptor.h> -#include <__ranges/size.h> -#include <__ranges/view_interface.h> -#include <__utility/forward.h> -#include <__utility/in_place.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - -template<class _Fn, class _View> -concept __regular_invocable_with_range_ref = - regular_invocable<_Fn, range_reference_t<_View>>; - -template<class _View, class _Fn> -concept __transform_view_constraints = - view<_View> && is_object_v<_Fn> && - regular_invocable<_Fn&, range_reference_t<_View>> && - __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>; - -template<input_range _View, copy_constructible _Fn> - requires __transform_view_constraints<_View, _Fn> -class transform_view : public view_interface<transform_view<_View, _Fn>> { - template<bool> class __iterator; - template<bool> class __sentinel; - - _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Fn> __func_; - _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); - -public: - _LIBCPP_HIDE_FROM_ABI - transform_view() - requires default_initializable<_View> && default_initializable<_Fn> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr transform_view(_View __base, _Fn __func) - : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() const& requires copy_constructible<_View> { return __base_; } - _LIBCPP_HIDE_FROM_ABI - constexpr _View base() && { return std::move(__base_); } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator<false> begin() { - return __iterator<false>{*this, ranges::begin(__base_)}; - } - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator<true> begin() const - requires range<const _View> && - __regular_invocable_with_range_ref<const _Fn&, const _View> - { - return __iterator<true>(*this, ranges::begin(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __sentinel<false> end() { - return __sentinel<false>(ranges::end(__base_)); - } - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator<false> end() - requires common_range<_View> - { - return __iterator<false>(*this, ranges::end(__base_)); - } - _LIBCPP_HIDE_FROM_ABI - constexpr __sentinel<true> end() const - requires range<const _View> && - __regular_invocable_with_range_ref<const _Fn&, const _View> - { - return __sentinel<true>(ranges::end(__base_)); - } - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator<true> end() const - requires common_range<const _View> && - __regular_invocable_with_range_ref<const _Fn&, const _View> - { - return __iterator<true>(*this, ranges::end(__base_)); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); } - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const requires sized_range<const _View> { return ranges::size(__base_); } -}; - -template<class _Range, class _Fn> -transform_view(_Range&&, _Fn) -> transform_view<views::all_t<_Range>, _Fn>; - -template<class _View> -struct __transform_view_iterator_concept { using type = input_iterator_tag; }; - -template<random_access_range _View> -struct __transform_view_iterator_concept<_View> { using type = random_access_iterator_tag; }; - -template<bidirectional_range _View> -struct __transform_view_iterator_concept<_View> { using type = bidirectional_iterator_tag; }; - -template<forward_range _View> -struct __transform_view_iterator_concept<_View> { using type = forward_iterator_tag; }; - -template<class, class> -struct __transform_view_iterator_category_base {}; - -template<forward_range _View, class _Fn> -struct __transform_view_iterator_category_base<_View, _Fn> { - using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category; - - using iterator_category = conditional_t< - is_lvalue_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>, - conditional_t< - derived_from<_Cat, contiguous_iterator_tag>, - random_access_iterator_tag, - _Cat - >, - input_iterator_tag - >; -}; - -template<input_range _View, copy_constructible _Fn> - requires __transform_view_constraints<_View, _Fn> -template<bool _Const> -class transform_view<_View, _Fn>::__iterator - : public __transform_view_iterator_category_base<_View, _Fn> { - - using _Parent = __maybe_const<_Const, transform_view>; - using _Base = __maybe_const<_Const, _View>; - - _Parent *__parent_ = nullptr; - - template<bool> - friend class transform_view<_View, _Fn>::__iterator; - - template<bool> - friend class transform_view<_View, _Fn>::__sentinel; - -public: - iterator_t<_Base> __current_ = iterator_t<_Base>(); - - using iterator_concept = typename __transform_view_iterator_concept<_View>::type; - using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>; - using difference_type = range_difference_t<_Base>; - - _LIBCPP_HIDE_FROM_ABI - __iterator() requires default_initializable<iterator_t<_Base>> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current) - : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {} - - // Note: `__i` should always be `__iterator<false>`, but directly using - // `__iterator<false>` is ill-formed when `_Const` is false - // (see http://wg21.link/class.copy.ctor#5). - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator(__iterator<!_Const> __i) - requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> - : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr const iterator_t<_Base>& base() const& noexcept { - return __current_; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr iterator_t<_Base> base() && { - return std::move(__current_); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) operator*() const - noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) - { - return std::invoke(*__parent_->__func_, *__current_); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator++() { - ++__current_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr void operator++(int) { ++__current_; } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator operator++(int) - requires forward_range<_Base> - { - auto __tmp = *this; - ++*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator--() - requires bidirectional_range<_Base> - { - --__current_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator operator--(int) - requires bidirectional_range<_Base> - { - auto __tmp = *this; - --*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator+=(difference_type __n) - requires random_access_range<_Base> - { - __current_ += __n; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iterator& operator-=(difference_type __n) - requires random_access_range<_Base> - { - __current_ -= __n; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) operator[](difference_type __n) const - noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n]))) - requires random_access_range<_Base> - { - return std::invoke(*__parent_->__func_, __current_[__n]); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) - requires equality_comparable<iterator_t<_Base>> - { - return __x.__current_ == __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) - requires random_access_range<_Base> - { - return __x.__current_ < __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) - requires random_access_range<_Base> - { - return __x.__current_ > __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) - requires random_access_range<_Base> - { - return __x.__current_ <= __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) - requires random_access_range<_Base> - { - return __x.__current_ >= __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) - requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>> - { - return __x.__current_ <=> __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iterator operator+(__iterator __i, difference_type __n) - requires random_access_range<_Base> - { - return __iterator{*__i.__parent_, __i.__current_ + __n}; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iterator operator+(difference_type __n, __iterator __i) - requires random_access_range<_Base> - { - return __iterator{*__i.__parent_, __i.__current_ + __n}; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iterator operator-(__iterator __i, difference_type __n) - requires random_access_range<_Base> - { - return __iterator{*__i.__parent_, __i.__current_ - __n}; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) - requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> - { - return __x.__current_ - __y.__current_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr decltype(auto) iter_move(const __iterator& __i) - noexcept(noexcept(*__i)) - { - if constexpr (is_lvalue_reference_v<decltype(*__i)>) - return std::move(*__i); - else - return *__i; - } -}; - -template<input_range _View, copy_constructible _Fn> - requires __transform_view_constraints<_View, _Fn> -template<bool _Const> -class transform_view<_View, _Fn>::__sentinel { - using _Parent = __maybe_const<_Const, transform_view>; - using _Base = __maybe_const<_Const, _View>; - - sentinel_t<_Base> __end_ = sentinel_t<_Base>(); - - template<bool> - friend class transform_view<_View, _Fn>::__iterator; - - template<bool> - friend class transform_view<_View, _Fn>::__sentinel; - -public: - _LIBCPP_HIDE_FROM_ABI - __sentinel() = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {} - - // Note: `__i` should always be `__sentinel<false>`, but directly using - // `__sentinel<false>` is ill-formed when `_Const` is false - // (see http://wg21.link/class.copy.ctor#5). - _LIBCPP_HIDE_FROM_ABI - constexpr __sentinel(__sentinel<!_Const> __i) - requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> - : __end_(std::move(__i.__end_)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr sentinel_t<_Base> base() const { return __end_; } - - template<bool _OtherConst> - requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { - return __x.__current_ == __y.__end_; - } - - template<bool _OtherConst> - requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI - friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> - operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { - return __x.__current_ - __y.__end_; - } - - template<bool _OtherConst> - requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI - friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> - operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { - return __x.__end_ - __y.__current_; - } -}; - -namespace views { -namespace __transform { - struct __fn { - template<class _Range, class _Fn> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Range&& __range, _Fn&& __f) const - noexcept(noexcept(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)))) - -> decltype( transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))) - { return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)); } - - template<class _Fn> - requires constructible_from<decay_t<_Fn>, _Fn> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Fn&& __f) const - noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) - { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f))); } - }; -} // namespace __transform - -inline namespace __cpo { - inline constexpr auto transform = __transform::__fn{}; -} // namespace __cpo -} // namespace views - -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_TRANSFORM_VIEW_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h deleted file mode 100644 index eecc475111..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/view_interface.h +++ /dev/null @@ -1,174 +0,0 @@ -// -*- 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_VIEW_INTERFACE_H -#define _LIBCPP___RANGES_VIEW_INTERFACE_H - -#include <__assert> -#include <__concepts/derived_from.h> -#include <__concepts/same_as.h> -#include <__config> -#include <__iterator/concepts.h> -#include <__iterator/iterator_traits.h> -#include <__iterator/prev.h> -#include <__memory/pointer_traits.h> -#include <__ranges/access.h> -#include <__ranges/concepts.h> -#include <__ranges/empty.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_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - -template<class _Derived> - requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> -class view_interface { - _LIBCPP_HIDE_FROM_ABI - constexpr _Derived& __derived() noexcept { - static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>); - return static_cast<_Derived&>(*this); - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Derived const& __derived() const noexcept { - static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>); - return static_cast<_Derived const&>(*this); - } - -public: - template<class _D2 = _Derived> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() - requires forward_range<_D2> - { - return ranges::begin(__derived()) == ranges::end(__derived()); - } - - template<class _D2 = _Derived> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const - requires forward_range<const _D2> - { - return ranges::begin(__derived()) == ranges::end(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr explicit operator bool() - requires requires (_D2& __t) { ranges::empty(__t); } - { - return !ranges::empty(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr explicit operator bool() const - requires requires (const _D2& __t) { ranges::empty(__t); } - { - return !ranges::empty(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr auto data() - requires contiguous_iterator<iterator_t<_D2>> - { - return std::to_address(ranges::begin(__derived())); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr auto data() const - requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>> - { - return std::to_address(ranges::begin(__derived())); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() - requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>> - { - return ranges::end(__derived()) - ranges::begin(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr auto size() const - requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>> - { - return ranges::end(__derived()) - ranges::begin(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) front() - requires forward_range<_D2> - { - _LIBCPP_ASSERT(!empty(), - "Precondition `!empty()` not satisfied. `.front()` called on an empty view."); - return *ranges::begin(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) front() const - requires forward_range<const _D2> - { - _LIBCPP_ASSERT(!empty(), - "Precondition `!empty()` not satisfied. `.front()` called on an empty view."); - return *ranges::begin(__derived()); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) back() - requires bidirectional_range<_D2> && common_range<_D2> - { - _LIBCPP_ASSERT(!empty(), - "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); - return *ranges::prev(ranges::end(__derived())); - } - - template<class _D2 = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) back() const - requires bidirectional_range<const _D2> && common_range<const _D2> - { - _LIBCPP_ASSERT(!empty(), - "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); - return *ranges::prev(ranges::end(__derived())); - } - - template<random_access_range _RARange = _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) - { - return ranges::begin(__derived())[__index]; - } - - template<random_access_range _RARange = const _Derived> - _LIBCPP_HIDE_FROM_ABI - constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const - { - return ranges::begin(__derived())[__index]; - } -}; - -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_VIEW_INTERFACE_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h deleted file mode 100644 index 8cc5ba3d2a..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__ranges/views.h +++ /dev/null @@ -1,35 +0,0 @@ -// -*- 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_VIEWS -#define _LIBCPP___RANGES_VIEWS - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -namespace ranges { - -namespace views { } - -} // namespace ranges - -namespace views = ranges::views; - -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___RANGES_VIEWS diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/cassert b/contrib/libs/cxxsupp/libcxxmsvc/include/cassert deleted file mode 100644 index 3c5bb7b110..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/cassert +++ /dev/null @@ -1,24 +0,0 @@ -// -*- 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 -// -//===----------------------------------------------------------------------===// - -/* - cassert synopsis - -Macros: - - assert - -*/ - -#include <__config> -#include <assert.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex b/contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex deleted file mode 100644 index f1037f2841..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/ccomplex +++ /dev/null @@ -1,28 +0,0 @@ -// -*- 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_CCOMPLEX -#define _LIBCPP_CCOMPLEX - -/* - ccomplex synopsis - -#include <complex> - -*/ - -#include <complex> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -// hh 080623 Created - -#endif // _LIBCPP_CCOMPLEX diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/cfenv b/contrib/libs/cxxsupp/libcxxmsvc/include/cfenv deleted file mode 100644 index e1aae2f009..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/cfenv +++ /dev/null @@ -1,81 +0,0 @@ -// -*- 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_CFENV -#define _LIBCPP_CFENV - -/* - cfenv synopsis - -This entire header is C99 / C++0X - -Macros: - - FE_DIVBYZERO - FE_INEXACT - FE_INVALID - FE_OVERFLOW - FE_UNDERFLOW - FE_ALL_EXCEPT - FE_DOWNWARD - FE_TONEAREST - FE_TOWARDZERO - FE_UPWARD - FE_DFL_ENV - -namespace std -{ - -Types: - - fenv_t - fexcept_t - -int feclearexcept(int excepts); -int fegetexceptflag(fexcept_t* flagp, int excepts); -int feraiseexcept(int excepts); -int fesetexceptflag(const fexcept_t* flagp, int excepts); -int fetestexcept(int excepts); -int fegetround(); -int fesetround(int round); -int fegetenv(fenv_t* envp); -int feholdexcept(fenv_t* envp); -int fesetenv(const fenv_t* envp); -int feupdateenv(const fenv_t* envp); - -} // std -*/ - -#include <__config> -#include <fenv.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -using ::fenv_t _LIBCPP_USING_IF_EXISTS; -using ::fexcept_t _LIBCPP_USING_IF_EXISTS; - -using ::feclearexcept _LIBCPP_USING_IF_EXISTS; -using ::fegetexceptflag _LIBCPP_USING_IF_EXISTS; -using ::feraiseexcept _LIBCPP_USING_IF_EXISTS; -using ::fesetexceptflag _LIBCPP_USING_IF_EXISTS; -using ::fetestexcept _LIBCPP_USING_IF_EXISTS; -using ::fegetround _LIBCPP_USING_IF_EXISTS; -using ::fesetround _LIBCPP_USING_IF_EXISTS; -using ::fegetenv _LIBCPP_USING_IF_EXISTS; -using ::feholdexcept _LIBCPP_USING_IF_EXISTS; -using ::fesetenv _LIBCPP_USING_IF_EXISTS; -using ::feupdateenv _LIBCPP_USING_IF_EXISTS; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_CFENV diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes b/contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes deleted file mode 100644 index 0674384b79..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/cinttypes +++ /dev/null @@ -1,257 +0,0 @@ -// -*- 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_CINTTYPES -#define _LIBCPP_CINTTYPES - -/* - cinttypes synopsis - -This entire header is C99 / C++0X - -#include <cstdint> // <cinttypes> includes <cstdint> - -Macros: - - PRId8 - PRId16 - PRId32 - PRId64 - - PRIdLEAST8 - PRIdLEAST16 - PRIdLEAST32 - PRIdLEAST64 - - PRIdFAST8 - PRIdFAST16 - PRIdFAST32 - PRIdFAST64 - - PRIdMAX - PRIdPTR - - PRIi8 - PRIi16 - PRIi32 - PRIi64 - - PRIiLEAST8 - PRIiLEAST16 - PRIiLEAST32 - PRIiLEAST64 - - PRIiFAST8 - PRIiFAST16 - PRIiFAST32 - PRIiFAST64 - - PRIiMAX - PRIiPTR - - PRIo8 - PRIo16 - PRIo32 - PRIo64 - - PRIoLEAST8 - PRIoLEAST16 - PRIoLEAST32 - PRIoLEAST64 - - PRIoFAST8 - PRIoFAST16 - PRIoFAST32 - PRIoFAST64 - - PRIoMAX - PRIoPTR - - PRIu8 - PRIu16 - PRIu32 - PRIu64 - - PRIuLEAST8 - PRIuLEAST16 - PRIuLEAST32 - PRIuLEAST64 - - PRIuFAST8 - PRIuFAST16 - PRIuFAST32 - PRIuFAST64 - - PRIuMAX - PRIuPTR - - PRIx8 - PRIx16 - PRIx32 - PRIx64 - - PRIxLEAST8 - PRIxLEAST16 - PRIxLEAST32 - PRIxLEAST64 - - PRIxFAST8 - PRIxFAST16 - PRIxFAST32 - PRIxFAST64 - - PRIxMAX - PRIxPTR - - PRIX8 - PRIX16 - PRIX32 - PRIX64 - - PRIXLEAST8 - PRIXLEAST16 - PRIXLEAST32 - PRIXLEAST64 - - PRIXFAST8 - PRIXFAST16 - PRIXFAST32 - PRIXFAST64 - - PRIXMAX - PRIXPTR - - SCNd8 - SCNd16 - SCNd32 - SCNd64 - - SCNdLEAST8 - SCNdLEAST16 - SCNdLEAST32 - SCNdLEAST64 - - SCNdFAST8 - SCNdFAST16 - SCNdFAST32 - SCNdFAST64 - - SCNdMAX - SCNdPTR - - SCNi8 - SCNi16 - SCNi32 - SCNi64 - - SCNiLEAST8 - SCNiLEAST16 - SCNiLEAST32 - SCNiLEAST64 - - SCNiFAST8 - SCNiFAST16 - SCNiFAST32 - SCNiFAST64 - - SCNiMAX - SCNiPTR - - SCNo8 - SCNo16 - SCNo32 - SCNo64 - - SCNoLEAST8 - SCNoLEAST16 - SCNoLEAST32 - SCNoLEAST64 - - SCNoFAST8 - SCNoFAST16 - SCNoFAST32 - SCNoFAST64 - - SCNoMAX - SCNoPTR - - SCNu8 - SCNu16 - SCNu32 - SCNu64 - - SCNuLEAST8 - SCNuLEAST16 - SCNuLEAST32 - SCNuLEAST64 - - SCNuFAST8 - SCNuFAST16 - SCNuFAST32 - SCNuFAST64 - - SCNuMAX - SCNuPTR - - SCNx8 - SCNx16 - SCNx32 - SCNx64 - - SCNxLEAST8 - SCNxLEAST16 - SCNxLEAST32 - SCNxLEAST64 - - SCNxFAST8 - SCNxFAST16 - SCNxFAST32 - SCNxFAST64 - - SCNxMAX - SCNxPTR - -namespace std -{ - -Types: - - imaxdiv_t - -intmax_t imaxabs(intmax_t j); -imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); -intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base); -uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base); -intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); -uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); - -} // std -*/ - -#include <__config> -#include <cstdint> -#include <inttypes.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -using ::imaxdiv_t _LIBCPP_USING_IF_EXISTS; -using ::imaxabs _LIBCPP_USING_IF_EXISTS; -using ::imaxdiv _LIBCPP_USING_IF_EXISTS; -using ::strtoimax _LIBCPP_USING_IF_EXISTS; -using ::strtoumax _LIBCPP_USING_IF_EXISTS; -using ::wcstoimax _LIBCPP_USING_IF_EXISTS; -using ::wcstoumax _LIBCPP_USING_IF_EXISTS; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_CINTTYPES diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/ciso646 b/contrib/libs/cxxsupp/libcxxmsvc/include/ciso646 deleted file mode 100644 index 1d859f08fa..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/ciso646 +++ /dev/null @@ -1,24 +0,0 @@ -// -*- 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_CISO646 -#define _LIBCPP_CISO646 - -/* - ciso646 synopsis - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#endif // _LIBCPP_CISO646 diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/complex b/contrib/libs/cxxsupp/libcxxmsvc/include/complex deleted file mode 100644 index a11334f6cf..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/complex +++ /dev/null @@ -1,1496 +0,0 @@ -// -*- 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_COMPLEX -#define _LIBCPP_COMPLEX - -/* - complex synopsis - -namespace std -{ - -template<class T> -class complex -{ -public: - typedef T value_type; - - complex(const T& re = T(), const T& im = T()); // constexpr in C++14 - complex(const complex&); // constexpr in C++14 - template<class X> complex(const complex<X>&); // constexpr in C++14 - - T real() const; // constexpr in C++14 - T imag() const; // constexpr in C++14 - - void real(T); - void imag(T); - - complex<T>& operator= (const T&); - complex<T>& operator+=(const T&); - complex<T>& operator-=(const T&); - complex<T>& operator*=(const T&); - complex<T>& operator/=(const T&); - - complex& operator=(const complex&); - template<class X> complex<T>& operator= (const complex<X>&); - template<class X> complex<T>& operator+=(const complex<X>&); - template<class X> complex<T>& operator-=(const complex<X>&); - template<class X> complex<T>& operator*=(const complex<X>&); - template<class X> complex<T>& operator/=(const complex<X>&); -}; - -template<> -class complex<float> -{ -public: - typedef float value_type; - - constexpr complex(float re = 0.0f, float im = 0.0f); - explicit constexpr complex(const complex<double>&); - explicit constexpr complex(const complex<long double>&); - - constexpr float real() const; - void real(float); - constexpr float imag() const; - void imag(float); - - complex<float>& operator= (float); - complex<float>& operator+=(float); - complex<float>& operator-=(float); - complex<float>& operator*=(float); - complex<float>& operator/=(float); - - complex<float>& operator=(const complex<float>&); - template<class X> complex<float>& operator= (const complex<X>&); - template<class X> complex<float>& operator+=(const complex<X>&); - template<class X> complex<float>& operator-=(const complex<X>&); - template<class X> complex<float>& operator*=(const complex<X>&); - template<class X> complex<float>& operator/=(const complex<X>&); -}; - -template<> -class complex<double> -{ -public: - typedef double value_type; - - constexpr complex(double re = 0.0, double im = 0.0); - constexpr complex(const complex<float>&); - explicit constexpr complex(const complex<long double>&); - - constexpr double real() const; - void real(double); - constexpr double imag() const; - void imag(double); - - complex<double>& operator= (double); - complex<double>& operator+=(double); - complex<double>& operator-=(double); - complex<double>& operator*=(double); - complex<double>& operator/=(double); - complex<double>& operator=(const complex<double>&); - - template<class X> complex<double>& operator= (const complex<X>&); - template<class X> complex<double>& operator+=(const complex<X>&); - template<class X> complex<double>& operator-=(const complex<X>&); - template<class X> complex<double>& operator*=(const complex<X>&); - template<class X> complex<double>& operator/=(const complex<X>&); -}; - -template<> -class complex<long double> -{ -public: - typedef long double value_type; - - constexpr complex(long double re = 0.0L, long double im = 0.0L); - constexpr complex(const complex<float>&); - constexpr complex(const complex<double>&); - - constexpr long double real() const; - void real(long double); - constexpr long double imag() const; - void imag(long double); - - complex<long double>& operator=(const complex<long double>&); - complex<long double>& operator= (long double); - complex<long double>& operator+=(long double); - complex<long double>& operator-=(long double); - complex<long double>& operator*=(long double); - complex<long double>& operator/=(long double); - - template<class X> complex<long double>& operator= (const complex<X>&); - template<class X> complex<long double>& operator+=(const complex<X>&); - template<class X> complex<long double>& operator-=(const complex<X>&); - template<class X> complex<long double>& operator*=(const complex<X>&); - template<class X> complex<long double>& operator/=(const complex<X>&); -}; - -// 26.3.6 operators: -template<class T> complex<T> operator+(const complex<T>&, const complex<T>&); -template<class T> complex<T> operator+(const complex<T>&, const T&); -template<class T> complex<T> operator+(const T&, const complex<T>&); -template<class T> complex<T> operator-(const complex<T>&, const complex<T>&); -template<class T> complex<T> operator-(const complex<T>&, const T&); -template<class T> complex<T> operator-(const T&, const complex<T>&); -template<class T> complex<T> operator*(const complex<T>&, const complex<T>&); -template<class T> complex<T> operator*(const complex<T>&, const T&); -template<class T> complex<T> operator*(const T&, const complex<T>&); -template<class T> complex<T> operator/(const complex<T>&, const complex<T>&); -template<class T> complex<T> operator/(const complex<T>&, const T&); -template<class T> complex<T> operator/(const T&, const complex<T>&); -template<class T> complex<T> operator+(const complex<T>&); -template<class T> complex<T> operator-(const complex<T>&); -template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14 -template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14 -template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14 -template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14 -template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14 -template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14 - -template<class T, class charT, class traits> - basic_istream<charT, traits>& - operator>>(basic_istream<charT, traits>&, complex<T>&); -template<class T, class charT, class traits> - basic_ostream<charT, traits>& - operator<<(basic_ostream<charT, traits>&, const complex<T>&); - -// 26.3.7 values: - -template<class T> T real(const complex<T>&); // constexpr in C++14 - long double real(long double); // constexpr in C++14 - double real(double); // constexpr in C++14 -template<Integral T> double real(T); // constexpr in C++14 - float real(float); // constexpr in C++14 - -template<class T> T imag(const complex<T>&); // constexpr in C++14 - long double imag(long double); // constexpr in C++14 - double imag(double); // constexpr in C++14 -template<Integral T> double imag(T); // constexpr in C++14 - float imag(float); // constexpr in C++14 - -template<class T> T abs(const complex<T>&); - -template<class T> T arg(const complex<T>&); - long double arg(long double); - double arg(double); -template<Integral T> double arg(T); - float arg(float); - -template<class T> T norm(const complex<T>&); - long double norm(long double); - double norm(double); -template<Integral T> double norm(T); - float norm(float); - -template<class T> complex<T> conj(const complex<T>&); - complex<long double> conj(long double); - complex<double> conj(double); -template<Integral T> complex<double> conj(T); - complex<float> conj(float); - -template<class T> complex<T> proj(const complex<T>&); - complex<long double> proj(long double); - complex<double> proj(double); -template<Integral T> complex<double> proj(T); - complex<float> proj(float); - -template<class T> complex<T> polar(const T&, const T& = T()); - -// 26.3.8 transcendentals: -template<class T> complex<T> acos(const complex<T>&); -template<class T> complex<T> asin(const complex<T>&); -template<class T> complex<T> atan(const complex<T>&); -template<class T> complex<T> acosh(const complex<T>&); -template<class T> complex<T> asinh(const complex<T>&); -template<class T> complex<T> atanh(const complex<T>&); -template<class T> complex<T> cos (const complex<T>&); -template<class T> complex<T> cosh (const complex<T>&); -template<class T> complex<T> exp (const complex<T>&); -template<class T> complex<T> log (const complex<T>&); -template<class T> complex<T> log10(const complex<T>&); - -template<class T> complex<T> pow(const complex<T>&, const T&); -template<class T> complex<T> pow(const complex<T>&, const complex<T>&); -template<class T> complex<T> pow(const T&, const complex<T>&); - -template<class T> complex<T> sin (const complex<T>&); -template<class T> complex<T> sinh (const complex<T>&); -template<class T> complex<T> sqrt (const complex<T>&); -template<class T> complex<T> tan (const complex<T>&); -template<class T> complex<T> tanh (const complex<T>&); - -} // std - -*/ - -#include <__config> -#include <cmath> -#include <iosfwd> -#include <stdexcept> -#include <type_traits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include <sstream> // for std::basic_ostringstream -#endif - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template<class _Tp> class _LIBCPP_TEMPLATE_VIS complex; - -template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w); -template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y); - -template<class _Tp> -class _LIBCPP_TEMPLATE_VIS complex -{ -public: - typedef _Tp value_type; -private: - value_type __re_; - value_type __im_; -public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - complex(const value_type& __re = value_type(), const value_type& __im = value_type()) - : __re_(__re), __im_(__im) {} - template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - complex(const complex<_Xp>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;} - - _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} - _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} - - _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) - {__re_ = __re; __im_ = value_type(); return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;} - - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) - { - __re_ = __c.real(); - __im_ = __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) - { - __re_ += __c.real(); - __im_ += __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) - { - __re_ -= __c.real(); - __im_ -= __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) - { - *this = *this * complex(__c.real(), __c.imag()); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) - { - *this = *this / complex(__c.real(), __c.imag()); - return *this; - } -}; - -template<> class _LIBCPP_TEMPLATE_VIS complex<double>; -template<> class _LIBCPP_TEMPLATE_VIS complex<long double>; - -template<> -class _LIBCPP_TEMPLATE_VIS complex<float> -{ - float __re_; - float __im_; -public: - typedef float value_type; - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) - : __re_(__re), __im_(__im) {} - _LIBCPP_INLINE_VISIBILITY - explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c); - _LIBCPP_INLINE_VISIBILITY - explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;} - - _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} - _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} - - _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) - {__re_ = __re; __im_ = value_type(); return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;} - - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) - { - __re_ = __c.real(); - __im_ = __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) - { - __re_ += __c.real(); - __im_ += __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) - { - __re_ -= __c.real(); - __im_ -= __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) - { - *this = *this * complex(__c.real(), __c.imag()); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) - { - *this = *this / complex(__c.real(), __c.imag()); - return *this; - } -}; - -template<> -class _LIBCPP_TEMPLATE_VIS complex<double> -{ - double __re_; - double __im_; -public: - typedef double value_type; - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) - : __re_(__re), __im_(__im) {} - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR complex(const complex<float>& __c); - _LIBCPP_INLINE_VISIBILITY - explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;} - - _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} - _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} - - _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) - {__re_ = __re; __im_ = value_type(); return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;} - - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) - { - __re_ = __c.real(); - __im_ = __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) - { - __re_ += __c.real(); - __im_ += __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) - { - __re_ -= __c.real(); - __im_ -= __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) - { - *this = *this * complex(__c.real(), __c.imag()); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) - { - *this = *this / complex(__c.real(), __c.imag()); - return *this; - } -}; - -template<> -class _LIBCPP_TEMPLATE_VIS complex<long double> -{ - long double __re_; - long double __im_; -public: - typedef long double value_type; - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) - : __re_(__re), __im_(__im) {} - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR complex(const complex<float>& __c); - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR complex(const complex<double>& __c); - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;} - - _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} - _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} - - _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) - {__re_ = __re; __im_ = value_type(); return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} - _LIBCPP_INLINE_VISIBILITY complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;} - - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator= (const complex<_Xp>& __c) - { - __re_ = __c.real(); - __im_ = __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator+=(const complex<_Xp>& __c) - { - __re_ += __c.real(); - __im_ += __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator-=(const complex<_Xp>& __c) - { - __re_ -= __c.real(); - __im_ -= __c.imag(); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c) - { - *this = *this * complex(__c.real(), __c.imag()); - return *this; - } - template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c) - { - *this = *this / complex(__c.real(), __c.imag()); - return *this; - } -}; - -inline -_LIBCPP_CONSTEXPR -complex<float>::complex(const complex<double>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - -inline -_LIBCPP_CONSTEXPR -complex<float>::complex(const complex<long double>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - -inline -_LIBCPP_CONSTEXPR -complex<double>::complex(const complex<float>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - -inline -_LIBCPP_CONSTEXPR -complex<double>::complex(const complex<long double>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - -inline -_LIBCPP_CONSTEXPR -complex<long double>::complex(const complex<float>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - -inline -_LIBCPP_CONSTEXPR -complex<long double>::complex(const complex<double>& __c) - : __re_(__c.real()), __im_(__c.imag()) {} - -// 26.3.6 operators: - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) -{ - complex<_Tp> __t(__x); - __t += __y; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator+(const complex<_Tp>& __x, const _Tp& __y) -{ - complex<_Tp> __t(__x); - __t += __y; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator+(const _Tp& __x, const complex<_Tp>& __y) -{ - complex<_Tp> __t(__y); - __t += __x; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) -{ - complex<_Tp> __t(__x); - __t -= __y; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator-(const complex<_Tp>& __x, const _Tp& __y) -{ - complex<_Tp> __t(__x); - __t -= __y; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator-(const _Tp& __x, const complex<_Tp>& __y) -{ - complex<_Tp> __t(-__y); - __t += __x; - return __t; -} - -template<class _Tp> -complex<_Tp> -operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) -{ - _Tp __a = __z.real(); - _Tp __b = __z.imag(); - _Tp __c = __w.real(); - _Tp __d = __w.imag(); - _Tp __ac = __a * __c; - _Tp __bd = __b * __d; - _Tp __ad = __a * __d; - _Tp __bc = __b * __c; - _Tp __x = __ac - __bd; - _Tp __y = __ad + __bc; - if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y)) - { - bool __recalc = false; - if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) - { - __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a); - __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b); - if (__libcpp_isnan_or_builtin(__c)) - __c = copysign(_Tp(0), __c); - if (__libcpp_isnan_or_builtin(__d)) - __d = copysign(_Tp(0), __d); - __recalc = true; - } - if (__libcpp_isinf_or_builtin(__c) || __libcpp_isinf_or_builtin(__d)) - { - __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c); - __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d); - if (__libcpp_isnan_or_builtin(__a)) - __a = copysign(_Tp(0), __a); - if (__libcpp_isnan_or_builtin(__b)) - __b = copysign(_Tp(0), __b); - __recalc = true; - } - if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) || - __libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc))) - { - if (__libcpp_isnan_or_builtin(__a)) - __a = copysign(_Tp(0), __a); - if (__libcpp_isnan_or_builtin(__b)) - __b = copysign(_Tp(0), __b); - if (__libcpp_isnan_or_builtin(__c)) - __c = copysign(_Tp(0), __c); - if (__libcpp_isnan_or_builtin(__d)) - __d = copysign(_Tp(0), __d); - __recalc = true; - } - if (__recalc) - { - __x = _Tp(INFINITY) * (__a * __c - __b * __d); - __y = _Tp(INFINITY) * (__a * __d + __b * __c); - } - } - return complex<_Tp>(__x, __y); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator*(const complex<_Tp>& __x, const _Tp& __y) -{ - complex<_Tp> __t(__x); - __t *= __y; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator*(const _Tp& __x, const complex<_Tp>& __y) -{ - complex<_Tp> __t(__y); - __t *= __x; - return __t; -} - -template<class _Tp> -complex<_Tp> -operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) -{ - int __ilogbw = 0; - _Tp __a = __z.real(); - _Tp __b = __z.imag(); - _Tp __c = __w.real(); - _Tp __d = __w.imag(); - _Tp __logbw = logb(fmax(fabs(__c), fabs(__d))); - if (__libcpp_isfinite_or_builtin(__logbw)) - { - __ilogbw = static_cast<int>(__logbw); - __c = scalbn(__c, -__ilogbw); - __d = scalbn(__d, -__ilogbw); - } - _Tp __denom = __c * __c + __d * __d; - _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw); - _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw); - if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y)) - { - if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b))) - { - __x = copysign(_Tp(INFINITY), __c) * __a; - __y = copysign(_Tp(INFINITY), __c) * __b; - } - else if ((__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) && __libcpp_isfinite_or_builtin(__c) && __libcpp_isfinite_or_builtin(__d)) - { - __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a); - __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b); - __x = _Tp(INFINITY) * (__a * __c + __b * __d); - __y = _Tp(INFINITY) * (__b * __c - __a * __d); - } - else if (__libcpp_isinf_or_builtin(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite_or_builtin(__a) && __libcpp_isfinite_or_builtin(__b)) - { - __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c); - __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d); - __x = _Tp(0) * (__a * __c + __b * __d); - __y = _Tp(0) * (__b * __c - __a * __d); - } - } - return complex<_Tp>(__x, __y); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator/(const complex<_Tp>& __x, const _Tp& __y) -{ - return complex<_Tp>(__x.real() / __y, __x.imag() / __y); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator/(const _Tp& __x, const complex<_Tp>& __y) -{ - complex<_Tp> __t(__x); - __t /= __y; - return __t; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator+(const complex<_Tp>& __x) -{ - return __x; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -operator-(const complex<_Tp>& __x) -{ - return complex<_Tp>(-__x.real(), -__x.imag()); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) -{ - return __x.real() == __y.real() && __x.imag() == __y.imag(); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator==(const complex<_Tp>& __x, const _Tp& __y) -{ - return __x.real() == __y && __x.imag() == 0; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator==(const _Tp& __x, const complex<_Tp>& __y) -{ - return __x == __y.real() && 0 == __y.imag(); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) -{ - return !(__x == __y); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator!=(const complex<_Tp>& __x, const _Tp& __y) -{ - return !(__x == __y); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator!=(const _Tp& __x, const complex<_Tp>& __y) -{ - return !(__x == __y); -} - -// 26.3.7 values: - -template <class _Tp, bool = is_integral<_Tp>::value, - bool = is_floating_point<_Tp>::value - > -struct __libcpp_complex_overload_traits {}; - -// Integral Types -template <class _Tp> -struct __libcpp_complex_overload_traits<_Tp, true, false> -{ - typedef double _ValueType; - typedef complex<double> _ComplexType; -}; - -// Floating point types -template <class _Tp> -struct __libcpp_complex_overload_traits<_Tp, false, true> -{ - typedef _Tp _ValueType; - typedef complex<_Tp> _ComplexType; -}; - -// real - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -_Tp -real(const complex<_Tp>& __c) -{ - return __c.real(); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename __libcpp_complex_overload_traits<_Tp>::_ValueType -real(_Tp __re) -{ - return __re; -} - -// imag - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -_Tp -imag(const complex<_Tp>& __c) -{ - return __c.imag(); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename __libcpp_complex_overload_traits<_Tp>::_ValueType -imag(_Tp) -{ - return 0; -} - -// abs - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_Tp -abs(const complex<_Tp>& __c) -{ - return hypot(__c.real(), __c.imag()); -} - -// arg - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_Tp -arg(const complex<_Tp>& __c) -{ - return atan2(__c.imag(), __c.real()); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if< - is_same<_Tp, long double>::value, - long double ->::type -arg(_Tp __re) -{ - return atan2l(0.L, __re); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value || is_same<_Tp, double>::value, - double ->::type -arg(_Tp __re) -{ - return atan2(0., __re); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if< - is_same<_Tp, float>::value, - float ->::type -arg(_Tp __re) -{ - return atan2f(0.F, __re); -} - -// norm - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_Tp -norm(const complex<_Tp>& __c) -{ - if (__libcpp_isinf_or_builtin(__c.real())) - return abs(__c.real()); - if (__libcpp_isinf_or_builtin(__c.imag())) - return abs(__c.imag()); - return __c.real() * __c.real() + __c.imag() * __c.imag(); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename __libcpp_complex_overload_traits<_Tp>::_ValueType -norm(_Tp __re) -{ - typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType; - return static_cast<_ValueType>(__re) * __re; -} - -// conj - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -conj(const complex<_Tp>& __c) -{ - return complex<_Tp>(__c.real(), -__c.imag()); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename __libcpp_complex_overload_traits<_Tp>::_ComplexType -conj(_Tp __re) -{ - typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType; - return _ComplexType(__re); -} - - - -// proj - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -proj(const complex<_Tp>& __c) -{ - complex<_Tp> __r = __c; - if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag())) - __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag())); - return __r; -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_floating_point<_Tp>::value, - typename __libcpp_complex_overload_traits<_Tp>::_ComplexType ->::type -proj(_Tp __re) -{ - if (__libcpp_isinf_or_builtin(__re)) - __re = abs(__re); - return complex<_Tp>(__re); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value, - typename __libcpp_complex_overload_traits<_Tp>::_ComplexType ->::type -proj(_Tp __re) -{ - typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType; - return _ComplexType(__re); -} - -// polar - -template<class _Tp> -complex<_Tp> -polar(const _Tp& __rho, const _Tp& __theta = _Tp()) -{ - if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho)) - return complex<_Tp>(_Tp(NAN), _Tp(NAN)); - if (__libcpp_isnan_or_builtin(__theta)) - { - if (__libcpp_isinf_or_builtin(__rho)) - return complex<_Tp>(__rho, __theta); - return complex<_Tp>(__theta, __theta); - } - if (__libcpp_isinf_or_builtin(__theta)) - { - if (__libcpp_isinf_or_builtin(__rho)) - return complex<_Tp>(__rho, _Tp(NAN)); - return complex<_Tp>(_Tp(NAN), _Tp(NAN)); - } - _Tp __x = __rho * cos(__theta); - if (__libcpp_isnan_or_builtin(__x)) - __x = 0; - _Tp __y = __rho * sin(__theta); - if (__libcpp_isnan_or_builtin(__y)) - __y = 0; - return complex<_Tp>(__x, __y); -} - -// log - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -log(const complex<_Tp>& __x) -{ - return complex<_Tp>(log(abs(__x)), arg(__x)); -} - -// log10 - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -log10(const complex<_Tp>& __x) -{ - return log(__x) / log(_Tp(10)); -} - -// sqrt - -template<class _Tp> -complex<_Tp> -sqrt(const complex<_Tp>& __x) -{ - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(_Tp(INFINITY), __x.imag()); - if (__libcpp_isinf_or_builtin(__x.real())) - { - if (__x.real() > _Tp(0)) - return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag())); - return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag())); - } - return polar(sqrt(abs(__x)), arg(__x) / _Tp(2)); -} - -// exp - -template<class _Tp> -complex<_Tp> -exp(const complex<_Tp>& __x) -{ - _Tp __i = __x.imag(); - if (__i == 0) { - return complex<_Tp>(exp(__x.real()), copysign(_Tp(0), __x.imag())); - } - if (__libcpp_isinf_or_builtin(__x.real())) - { - if (__x.real() < _Tp(0)) - { - if (!__libcpp_isfinite_or_builtin(__i)) - __i = _Tp(1); - } - else if (__i == 0 || !__libcpp_isfinite_or_builtin(__i)) - { - if (__libcpp_isinf_or_builtin(__i)) - __i = _Tp(NAN); - return complex<_Tp>(__x.real(), __i); - } - } - _Tp __e = exp(__x.real()); - return complex<_Tp>(__e * cos(__i), __e * sin(__i)); -} - -// pow - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -pow(const complex<_Tp>& __x, const complex<_Tp>& __y) -{ - return exp(__y * log(__x)); -} - -template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY -complex<typename __promote<_Tp, _Up>::type> -pow(const complex<_Tp>& __x, const complex<_Up>& __y) -{ - typedef complex<typename __promote<_Tp, _Up>::type> result_type; - return _VSTD::pow(result_type(__x), result_type(__y)); -} - -template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_arithmetic<_Up>::value, - complex<typename __promote<_Tp, _Up>::type> ->::type -pow(const complex<_Tp>& __x, const _Up& __y) -{ - typedef complex<typename __promote<_Tp, _Up>::type> result_type; - return _VSTD::pow(result_type(__x), result_type(__y)); -} - -template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_arithmetic<_Tp>::value, - complex<typename __promote<_Tp, _Up>::type> ->::type -pow(const _Tp& __x, const complex<_Up>& __y) -{ - typedef complex<typename __promote<_Tp, _Up>::type> result_type; - return _VSTD::pow(result_type(__x), result_type(__y)); -} - -// __sqr, computes pow(x, 2) - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -__sqr(const complex<_Tp>& __x) -{ - return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), - _Tp(2) * __x.real() * __x.imag()); -} - -// asinh - -template<class _Tp> -complex<_Tp> -asinh(const complex<_Tp>& __x) -{ - const _Tp __pi(atan2(+0., -0.)); - if (__libcpp_isinf_or_builtin(__x.real())) - { - if (__libcpp_isnan_or_builtin(__x.imag())) - return __x; - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); - return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); - } - if (__libcpp_isnan_or_builtin(__x.real())) - { - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(__x.imag(), __x.real()); - if (__x.imag() == 0) - return __x; - return complex<_Tp>(__x.real(), __x.real()); - } - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag())); - complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1))); - return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); -} - -// acosh - -template<class _Tp> -complex<_Tp> -acosh(const complex<_Tp>& __x) -{ - const _Tp __pi(atan2(+0., -0.)); - if (__libcpp_isinf_or_builtin(__x.real())) - { - if (__libcpp_isnan_or_builtin(__x.imag())) - return complex<_Tp>(abs(__x.real()), __x.imag()); - if (__libcpp_isinf_or_builtin(__x.imag())) - { - if (__x.real() > 0) - return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); - else - return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); - } - if (__x.real() < 0) - return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); - return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); - } - if (__libcpp_isnan_or_builtin(__x.real())) - { - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(abs(__x.imag()), __x.real()); - return complex<_Tp>(__x.real(), __x.real()); - } - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag())); - complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); - return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag())); -} - -// atanh - -template<class _Tp> -complex<_Tp> -atanh(const complex<_Tp>& __x) -{ - const _Tp __pi(atan2(+0., -0.)); - if (__libcpp_isinf_or_builtin(__x.imag())) - { - return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); - } - if (__libcpp_isnan_or_builtin(__x.imag())) - { - if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0) - return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag()); - return complex<_Tp>(__x.imag(), __x.imag()); - } - if (__libcpp_isnan_or_builtin(__x.real())) - { - return complex<_Tp>(__x.real(), __x.real()); - } - if (__libcpp_isinf_or_builtin(__x.real())) - { - return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); - } - if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) - { - return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag())); - } - complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2); - return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); -} - -// sinh - -template<class _Tp> -complex<_Tp> -sinh(const complex<_Tp>& __x) -{ - if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag())) - return complex<_Tp>(__x.real(), _Tp(NAN)); - if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag())) - return complex<_Tp>(__x.real(), _Tp(NAN)); - if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real())) - return __x; - return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag())); -} - -// cosh - -template<class _Tp> -complex<_Tp> -cosh(const complex<_Tp>& __x) -{ - if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag())) - return complex<_Tp>(abs(__x.real()), _Tp(NAN)); - if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag())) - return complex<_Tp>(_Tp(NAN), __x.real()); - if (__x.real() == 0 && __x.imag() == 0) - return complex<_Tp>(_Tp(1), __x.imag()); - if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real())) - return complex<_Tp>(abs(__x.real()), __x.imag()); - return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag())); -} - -// tanh - -template<class _Tp> -complex<_Tp> -tanh(const complex<_Tp>& __x) -{ - if (__libcpp_isinf_or_builtin(__x.real())) - { - if (!__libcpp_isfinite_or_builtin(__x.imag())) - return complex<_Tp>(copysign(_Tp(1), __x.real()), _Tp(0)); - return complex<_Tp>(copysign(_Tp(1), __x.real()), copysign(_Tp(0), sin(_Tp(2) * __x.imag()))); - } - if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0) - return __x; - _Tp __2r(_Tp(2) * __x.real()); - _Tp __2i(_Tp(2) * __x.imag()); - _Tp __d(cosh(__2r) + cos(__2i)); - _Tp __2rsh(sinh(__2r)); - if (__libcpp_isinf_or_builtin(__2rsh) && __libcpp_isinf_or_builtin(__d)) - return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), - __2i > _Tp(0) ? _Tp(0) : _Tp(-0.)); - return complex<_Tp>(__2rsh/__d, sin(__2i)/__d); -} - -// asin - -template<class _Tp> -complex<_Tp> -asin(const complex<_Tp>& __x) -{ - complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real())); - return complex<_Tp>(__z.imag(), -__z.real()); -} - -// acos - -template<class _Tp> -complex<_Tp> -acos(const complex<_Tp>& __x) -{ - const _Tp __pi(atan2(+0., -0.)); - if (__libcpp_isinf_or_builtin(__x.real())) - { - if (__libcpp_isnan_or_builtin(__x.imag())) - return complex<_Tp>(__x.imag(), __x.real()); - if (__libcpp_isinf_or_builtin(__x.imag())) - { - if (__x.real() < _Tp(0)) - return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag()); - return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag()); - } - if (__x.real() < _Tp(0)) - return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real()); - return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real()); - } - if (__libcpp_isnan_or_builtin(__x.real())) - { - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(__x.real(), -__x.imag()); - return complex<_Tp>(__x.real(), __x.real()); - } - if (__libcpp_isinf_or_builtin(__x.imag())) - return complex<_Tp>(__pi/_Tp(2), -__x.imag()); - if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag()))) - return complex<_Tp>(__pi/_Tp(2), -__x.imag()); - complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); - if (signbit(__x.imag())) - return complex<_Tp>(abs(__z.imag()), abs(__z.real())); - return complex<_Tp>(abs(__z.imag()), -abs(__z.real())); -} - -// atan - -template<class _Tp> -complex<_Tp> -atan(const complex<_Tp>& __x) -{ - complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real())); - return complex<_Tp>(__z.imag(), -__z.real()); -} - -// sin - -template<class _Tp> -complex<_Tp> -sin(const complex<_Tp>& __x) -{ - complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real())); - return complex<_Tp>(__z.imag(), -__z.real()); -} - -// cos - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -complex<_Tp> -cos(const complex<_Tp>& __x) -{ - return cosh(complex<_Tp>(-__x.imag(), __x.real())); -} - -// tan - -template<class _Tp> -complex<_Tp> -tan(const complex<_Tp>& __x) -{ - complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real())); - return complex<_Tp>(__z.imag(), -__z.real()); -} - -template<class _Tp, class _CharT, class _Traits> -basic_istream<_CharT, _Traits>& -operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) -{ - if (__is.good()) - { - ws(__is); - if (__is.peek() == _CharT('(')) - { - __is.get(); - _Tp __r; - __is >> __r; - if (!__is.fail()) - { - ws(__is); - _CharT __c = __is.peek(); - if (__c == _CharT(',')) - { - __is.get(); - _Tp __i; - __is >> __i; - if (!__is.fail()) - { - ws(__is); - __c = __is.peek(); - if (__c == _CharT(')')) - { - __is.get(); - __x = complex<_Tp>(__r, __i); - } - else - __is.setstate(__is.failbit); - } - else - __is.setstate(__is.failbit); - } - else if (__c == _CharT(')')) - { - __is.get(); - __x = complex<_Tp>(__r, _Tp(0)); - } - else - __is.setstate(__is.failbit); - } - else - __is.setstate(__is.failbit); - } - else - { - _Tp __r; - __is >> __r; - if (!__is.fail()) - __x = complex<_Tp>(__r, _Tp(0)); - else - __is.setstate(__is.failbit); - } - } - else - __is.setstate(__is.failbit); - return __is; -} - -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -template<class _Tp, class _CharT, class _Traits> -basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) -{ - basic_ostringstream<_CharT, _Traits> __s; - __s.flags(__os.flags()); - __s.imbue(__os.getloc()); - __s.precision(__os.precision()); - __s << '(' << __x.real() << ',' << __x.imag() << ')'; - return __os << __s.str(); -} -#endif // !_LIBCPP_HAS_NO_LOCALIZATION - -#if _LIBCPP_STD_VER > 11 -// Literal suffix for complex number literals [complex.literals] -inline namespace literals -{ - inline namespace complex_literals - { - constexpr complex<long double> operator""il(long double __im) - { - return { 0.0l, __im }; - } - - constexpr complex<long double> operator""il(unsigned long long __im) - { - return { 0.0l, static_cast<long double>(__im) }; - } - - - constexpr complex<double> operator""i(long double __im) - { - return { 0.0, static_cast<double>(__im) }; - } - - constexpr complex<double> operator""i(unsigned long long __im) - { - return { 0.0, static_cast<double>(__im) }; - } - - -#if !defined(__CUDACC__) - constexpr complex<float> operator""if(long double __im) - { - return { 0.0f, static_cast<float>(__im) }; - } - - constexpr complex<float> operator""if(unsigned long long __im) - { - return { 0.0f, static_cast<float>(__im) }; - } -#endif - } // namespace complex_literals -} // namespace literals -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_COMPLEX diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/complex.h b/contrib/libs/cxxsupp/libcxxmsvc/include/complex.h deleted file mode 100644 index 58cbbaaeef..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/complex.h +++ /dev/null @@ -1,40 +0,0 @@ -// -*- 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_COMPLEX_H -#define _LIBCPP_COMPLEX_H - -/* - complex.h synopsis - -#include <ccomplex> - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#ifdef __cplusplus - -#include <ccomplex> - -#else // __cplusplus - -#ifdef _LIBCPP_COMPILER_MSVC -#include Y_UCRT_INCLUDE_NEXT(complex.h) -#else -#include_next <complex.h> -#endif - -#endif // __cplusplus - -#endif // _LIBCPP_COMPLEX_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/coroutine b/contrib/libs/cxxsupp/libcxxmsvc/include/coroutine deleted file mode 100644 index 478f4723f9..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/coroutine +++ /dev/null @@ -1,52 +0,0 @@ -// -*- 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_COROUTINE -#define _LIBCPP_COROUTINE - -/** - coroutine synopsis - -namespace std { -// [coroutine.traits] -template <class R, class... ArgTypes> - struct coroutine_traits; -// [coroutine.handle] -template <class Promise = void> - struct coroutine_handle; -// [coroutine.handle.compare] -constexpr bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept; -constexpr strong_ordering operator<=>(coroutine_handle<> x, coroutine_handle<> y) noexcept; -// [coroutine.handle.hash] -template <class T> struct hash; -template <class P> struct hash<coroutine_handle<P>>; -// [coroutine.noop] -struct noop_coroutine_promise; -template<> struct coroutine_handle<noop_coroutine_promise>; -using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>; -noop_coroutine_handle noop_coroutine() noexcept; -// [coroutine.trivial.awaitables] -struct suspend_never; -struct suspend_always; -} // namespace std - - */ - -#include <__config> -#include <__coroutine/coroutine_handle.h> -#include <__coroutine/coroutine_traits.h> -#include <__coroutine/noop_coroutine_handle.h> -#include <__coroutine/trivial_awaitables.h> -#include <version> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -#endif // _LIBCPP_COROUTINE diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp b/contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp deleted file mode 100644 index 76cbaab4c3..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/csetjmp +++ /dev/null @@ -1,47 +0,0 @@ -// -*- 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_CSETJMP -#define _LIBCPP_CSETJMP - -/* - csetjmp synopsis - -Macros: - - setjmp - -namespace std -{ - -Types: - - jmp_buf - -void longjmp(jmp_buf env, int val); - -} // std - -*/ - -#include <__config> -#include <setjmp.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -using ::jmp_buf _LIBCPP_USING_IF_EXISTS; -using ::longjmp _LIBCPP_USING_IF_EXISTS; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_CSETJMP diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/csignal b/contrib/libs/cxxsupp/libcxxmsvc/include/csignal deleted file mode 100644 index 19091cfaa2..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/csignal +++ /dev/null @@ -1,57 +0,0 @@ -// -*- 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_CSIGNAL -#define _LIBCPP_CSIGNAL - -/* - csignal synopsis - -Macros: - - SIG_DFL - SIG_ERR - SIG_IGN - SIGABRT - SIGFPE - SIGILL - SIGINT - SIGSEGV - SIGTERM - -namespace std -{ - -Types: - - sig_atomic_t - -void (*signal(int sig, void (*func)(int)))(int); -int raise(int sig); - -} // std - -*/ - -#include <__config> -#include <signal.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -using ::sig_atomic_t _LIBCPP_USING_IF_EXISTS; -using ::signal _LIBCPP_USING_IF_EXISTS; -using ::raise _LIBCPP_USING_IF_EXISTS; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_CSIGNAL diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h b/contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h deleted file mode 100644 index 5a8cebf65f..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/fenv.h +++ /dev/null @@ -1,120 +0,0 @@ -// -*- 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_FENV_H -#define _LIBCPP_FENV_H - - -/* - fenv.h synopsis - -This entire header is C99 / C++0X - -Macros: - - FE_DIVBYZERO - FE_INEXACT - FE_INVALID - FE_OVERFLOW - FE_UNDERFLOW - FE_ALL_EXCEPT - FE_DOWNWARD - FE_TONEAREST - FE_TOWARDZERO - FE_UPWARD - FE_DFL_ENV - -Types: - - fenv_t - fexcept_t - -int feclearexcept(int excepts); -int fegetexceptflag(fexcept_t* flagp, int excepts); -int feraiseexcept(int excepts); -int fesetexceptflag(const fexcept_t* flagp, int excepts); -int fetestexcept(int excepts); -int fegetround(); -int fesetround(int round); -int fegetenv(fenv_t* envp); -int feholdexcept(fenv_t* envp); -int fesetenv(const fenv_t* envp); -int feupdateenv(const fenv_t* envp); - - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#ifdef _LIBCPP_COMPILER_MSVC -#include Y_UCRT_INCLUDE_NEXT(fenv.h) -#else -#include_next <fenv.h> -#endif - -#ifdef __cplusplus - -extern "C++" { - -#ifdef feclearexcept -#undef feclearexcept -#endif - -#ifdef fegetexceptflag -#undef fegetexceptflag -#endif - - -#ifdef feraiseexcept -#undef feraiseexcept -#endif - -#ifdef fesetexceptflag -#undef fesetexceptflag -#endif - - -#ifdef fetestexcept -#undef fetestexcept -#endif - -#ifdef fegetround -#undef fegetround -#endif - -#ifdef fesetround -#undef fesetround -#endif - -#ifdef fegetenv -#undef fegetenv -#endif - -#ifdef feholdexcept -#undef feholdexcept -#endif - - -#ifdef fesetenv -#undef fesetenv -#endif - -#ifdef feupdateenv -#undef feupdateenv -#endif - -} // extern "C++" - -#endif // defined(__cplusplus) - -#endif // _LIBCPP_FENV_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/forward_list b/contrib/libs/cxxsupp/libcxxmsvc/include/forward_list deleted file mode 100644 index e01a8e7189..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/forward_list +++ /dev/null @@ -1,1791 +0,0 @@ -// -*- 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_FORWARD_LIST -#define _LIBCPP_FORWARD_LIST - -/* - forward_list synopsis - -namespace std -{ - -template <class T, class Allocator = allocator<T>> -class forward_list -{ -public: - typedef T value_type; - typedef Allocator allocator_type; - - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; - - typedef <details> iterator; - typedef <details> const_iterator; - - forward_list() - noexcept(is_nothrow_default_constructible<allocator_type>::value); - explicit forward_list(const allocator_type& a); - explicit forward_list(size_type n); - explicit forward_list(size_type n, const allocator_type& a); // C++14 - forward_list(size_type n, const value_type& v); - forward_list(size_type n, const value_type& v, const allocator_type& a); - template <class InputIterator> - forward_list(InputIterator first, InputIterator last); - template <class InputIterator> - forward_list(InputIterator first, InputIterator last, const allocator_type& a); - forward_list(const forward_list& x); - forward_list(const forward_list& x, const allocator_type& a); - forward_list(forward_list&& x) - noexcept(is_nothrow_move_constructible<allocator_type>::value); - forward_list(forward_list&& x, const allocator_type& a); - forward_list(initializer_list<value_type> il); - forward_list(initializer_list<value_type> il, const allocator_type& a); - - ~forward_list(); - - forward_list& operator=(const forward_list& x); - forward_list& operator=(forward_list&& x) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); - forward_list& operator=(initializer_list<value_type> il); - - template <class InputIterator> - void assign(InputIterator first, InputIterator last); - void assign(size_type n, const value_type& v); - void assign(initializer_list<value_type> il); - - allocator_type get_allocator() const noexcept; - - iterator begin() noexcept; - const_iterator begin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; - - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - iterator before_begin() noexcept; - const_iterator before_begin() const noexcept; - const_iterator cbefore_begin() const noexcept; - - bool empty() const noexcept; - size_type max_size() const noexcept; - - reference front(); - const_reference front() const; - - template <class... Args> reference emplace_front(Args&&... args); // reference in C++17 - void push_front(const value_type& v); - void push_front(value_type&& v); - - void pop_front(); - - template <class... Args> - iterator emplace_after(const_iterator p, Args&&... args); - iterator insert_after(const_iterator p, const value_type& v); - iterator insert_after(const_iterator p, value_type&& v); - iterator insert_after(const_iterator p, size_type n, const value_type& v); - template <class InputIterator> - iterator insert_after(const_iterator p, - InputIterator first, InputIterator last); - iterator insert_after(const_iterator p, initializer_list<value_type> il); - - iterator erase_after(const_iterator p); - iterator erase_after(const_iterator first, const_iterator last); - - void swap(forward_list& x) - noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17 - - void resize(size_type n); - void resize(size_type n, const value_type& v); - void clear() noexcept; - - void splice_after(const_iterator p, forward_list& x); - void splice_after(const_iterator p, forward_list&& x); - void splice_after(const_iterator p, forward_list& x, const_iterator i); - void splice_after(const_iterator p, forward_list&& x, const_iterator i); - void splice_after(const_iterator p, forward_list& x, - const_iterator first, const_iterator last); - void splice_after(const_iterator p, forward_list&& x, - const_iterator first, const_iterator last); - size_type remove(const value_type& v); // void before C++20 - template <class Predicate> - size_type remove_if(Predicate pred); // void before C++20 - size_type unique(); // void before C++20 - template <class BinaryPredicate> - size_type unique(BinaryPredicate binary_pred); // void before C++20 - void merge(forward_list& x); - void merge(forward_list&& x); - template <class Compare> void merge(forward_list& x, Compare comp); - template <class Compare> void merge(forward_list&& x, Compare comp); - void sort(); - template <class Compare> void sort(Compare comp); - void reverse() noexcept; -}; - - -template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> - forward_list(InputIterator, InputIterator, Allocator = Allocator()) - -> forward_list<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17 - -template <class T, class Allocator> - bool operator==(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); - -template <class T, class Allocator> - bool operator< (const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); - -template <class T, class Allocator> - bool operator!=(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); - -template <class T, class Allocator> - bool operator> (const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); - -template <class T, class Allocator> - bool operator>=(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); - -template <class T, class Allocator> - bool operator<=(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); - -template <class T, class Allocator> - void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y) - noexcept(noexcept(x.swap(y))); - -template <class T, class Allocator, class U> - typename forward_list<T, Allocator>::size_type - erase(forward_list<T, Allocator>& c, const U& value); // C++20 -template <class T, class Allocator, class Predicate> - typename forward_list<T, Allocator>::size_type - erase_if(forward_list<T, Allocator>& c, Predicate pred); // C++20 - -} // std - -*/ - -#include <__algorithm/comp.h> -#include <__algorithm/lexicographical_compare.h> -#include <__algorithm/min.h> -#include <__config> -#include <__utility/forward.h> -#include <initializer_list> -#include <iterator> -#include <limits> -#include <memory> -#include <type_traits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp, class _VoidPtr> struct __forward_list_node; -template <class _NodePtr> struct __forward_begin_node; - - -template <class> -struct __forward_list_node_value_type; - -template <class _Tp, class _VoidPtr> -struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > { - typedef _Tp type; -}; - -template <class _NodePtr> -struct __forward_node_traits { - - typedef typename remove_cv< - typename pointer_traits<_NodePtr>::element_type>::type __node; - typedef typename __forward_list_node_value_type<__node>::type __node_value_type; - typedef _NodePtr __node_pointer; - typedef __forward_begin_node<_NodePtr> __begin_node; - typedef typename __rebind_pointer<_NodePtr, __begin_node>::type - __begin_node_pointer; - typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; - -#if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB) - typedef __begin_node_pointer __iter_node_pointer; -#else - typedef typename conditional< - is_pointer<__void_pointer>::value, - __begin_node_pointer, - __node_pointer - >::type __iter_node_pointer; -#endif - - typedef typename conditional< - is_same<__iter_node_pointer, __node_pointer>::value, - __begin_node_pointer, - __node_pointer - >::type __non_iter_node_pointer; - - _LIBCPP_INLINE_VISIBILITY - static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { - return __p; - } - _LIBCPP_INLINE_VISIBILITY - static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) { - return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p)); - } -}; - -template <class _NodePtr> -struct __forward_begin_node -{ - typedef _NodePtr pointer; - typedef typename __rebind_pointer<_NodePtr, __forward_begin_node>::type __begin_node_pointer; - - pointer __next_; - - _LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - __begin_node_pointer __next_as_begin() const { - return static_cast<__begin_node_pointer>(__next_); - } -}; - -template <class _Tp, class _VoidPtr> -struct _LIBCPP_HIDDEN __begin_node_of -{ - typedef __forward_begin_node< - typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type - > type; -}; - -template <class _Tp, class _VoidPtr> -struct _LIBCPP_STANDALONE_DEBUG __forward_list_node - : public __begin_node_of<_Tp, _VoidPtr>::type -{ - typedef _Tp value_type; - - value_type __value_; -}; - - -template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS forward_list; -template<class _NodeConstPtr> class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator; - -template <class _NodePtr> -class _LIBCPP_TEMPLATE_VIS __forward_list_iterator -{ - typedef __forward_node_traits<_NodePtr> __traits; - typedef typename __traits::__node_pointer __node_pointer; - typedef typename __traits::__begin_node_pointer __begin_node_pointer; - typedef typename __traits::__iter_node_pointer __iter_node_pointer; - typedef typename __traits::__void_pointer __void_pointer; - - __iter_node_pointer __ptr_; - - _LIBCPP_INLINE_VISIBILITY - __begin_node_pointer __get_begin() const { - return static_cast<__begin_node_pointer>( - static_cast<__void_pointer>(__ptr_)); - } - _LIBCPP_INLINE_VISIBILITY - __node_pointer __get_unsafe_node_pointer() const { - return static_cast<__node_pointer>( - static_cast<__void_pointer>(__ptr_)); - } - - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_iterator(__begin_node_pointer __p) _NOEXCEPT - : __ptr_(__traits::__as_iter_node(__p)) {} - - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT - : __ptr_(__traits::__as_iter_node(__p)) {} - - template<class, class> friend class _LIBCPP_TEMPLATE_VIS forward_list; - template<class> friend class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator; - -public: - typedef forward_iterator_tag iterator_category; - typedef typename __traits::__node_value_type value_type; - typedef value_type& reference; - typedef typename pointer_traits<__node_pointer>::difference_type - difference_type; - typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; - - _LIBCPP_INLINE_VISIBILITY - __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - reference operator*() const {return __get_unsafe_node_pointer()->__value_;} - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const { - return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__value_); - } - - _LIBCPP_INLINE_VISIBILITY - __forward_list_iterator& operator++() - { - __ptr_ = __traits::__as_iter_node(__ptr_->__next_); - return *this; - } - _LIBCPP_INLINE_VISIBILITY - __forward_list_iterator operator++(int) - { - __forward_list_iterator __t(*this); - ++(*this); - return __t; - } - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const __forward_list_iterator& __x, - const __forward_list_iterator& __y) - {return __x.__ptr_ == __y.__ptr_;} - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const __forward_list_iterator& __x, - const __forward_list_iterator& __y) - {return !(__x == __y);} -}; - -template <class _NodeConstPtr> -class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator -{ - static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), ""); - typedef _NodeConstPtr _NodePtr; - - typedef __forward_node_traits<_NodePtr> __traits; - typedef typename __traits::__node __node; - typedef typename __traits::__node_pointer __node_pointer; - typedef typename __traits::__begin_node_pointer __begin_node_pointer; - typedef typename __traits::__iter_node_pointer __iter_node_pointer; - typedef typename __traits::__void_pointer __void_pointer; - - __iter_node_pointer __ptr_; - - __begin_node_pointer __get_begin() const { - return static_cast<__begin_node_pointer>( - static_cast<__void_pointer>(__ptr_)); - } - __node_pointer __get_unsafe_node_pointer() const { - return static_cast<__node_pointer>( - static_cast<__void_pointer>(__ptr_)); - } - - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT - : __ptr_(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_const_iterator(__begin_node_pointer __p) _NOEXCEPT - : __ptr_(__traits::__as_iter_node(__p)) {} - - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_const_iterator(__node_pointer __p) _NOEXCEPT - : __ptr_(__traits::__as_iter_node(__p)) {} - - - template<class, class> friend class forward_list; - -public: - typedef forward_iterator_tag iterator_category; - typedef typename __traits::__node_value_type value_type; - typedef const value_type& reference; - typedef typename pointer_traits<__node_pointer>::difference_type - difference_type; - typedef typename __rebind_pointer<__node_pointer, const value_type>::type - pointer; - - _LIBCPP_INLINE_VISIBILITY - __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {} - _LIBCPP_INLINE_VISIBILITY - __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT - : __ptr_(__p.__ptr_) {} - - _LIBCPP_INLINE_VISIBILITY - reference operator*() const {return __get_unsafe_node_pointer()->__value_;} - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const {return pointer_traits<pointer>::pointer_to( - __get_unsafe_node_pointer()->__value_);} - - _LIBCPP_INLINE_VISIBILITY - __forward_list_const_iterator& operator++() - { - __ptr_ = __traits::__as_iter_node(__ptr_->__next_); - return *this; - } - _LIBCPP_INLINE_VISIBILITY - __forward_list_const_iterator operator++(int) - { - __forward_list_const_iterator __t(*this); - ++(*this); - return __t; - } - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const __forward_list_const_iterator& __x, - const __forward_list_const_iterator& __y) - {return __x.__ptr_ == __y.__ptr_;} - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const __forward_list_const_iterator& __x, - const __forward_list_const_iterator& __y) - {return !(__x == __y);} -}; - -template <class _Tp, class _Alloc> -class __forward_list_base -{ -protected: - typedef _Tp value_type; - typedef _Alloc allocator_type; - - typedef typename allocator_traits<allocator_type>::void_pointer void_pointer; - typedef __forward_list_node<value_type, void_pointer> __node; - typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node; - typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator; - typedef allocator_traits<__node_allocator> __node_traits; - typedef typename __node_traits::pointer __node_pointer; - - typedef typename __rebind_alloc_helper< - allocator_traits<allocator_type>, __begin_node - >::type __begin_node_allocator; - typedef typename allocator_traits<__begin_node_allocator>::pointer - __begin_node_pointer; - - static_assert((!is_same<allocator_type, __node_allocator>::value), - "internal allocator type must differ from user-specified " - "type; otherwise overload resolution breaks"); - - __compressed_pair<__begin_node, __node_allocator> __before_begin_; - - _LIBCPP_INLINE_VISIBILITY - __begin_node_pointer __before_begin() _NOEXCEPT - {return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());} - _LIBCPP_INLINE_VISIBILITY - __begin_node_pointer __before_begin() const _NOEXCEPT - {return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));} - - _LIBCPP_INLINE_VISIBILITY - __node_allocator& __alloc() _NOEXCEPT - {return __before_begin_.second();} - _LIBCPP_INLINE_VISIBILITY - const __node_allocator& __alloc() const _NOEXCEPT - {return __before_begin_.second();} - - typedef __forward_list_iterator<__node_pointer> iterator; - typedef __forward_list_const_iterator<__node_pointer> const_iterator; - - _LIBCPP_INLINE_VISIBILITY - __forward_list_base() - _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - : __before_begin_(__begin_node(), __default_init_tag()) {} - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_base(const allocator_type& __a) - : __before_begin_(__begin_node(), __node_allocator(__a)) {} - _LIBCPP_INLINE_VISIBILITY - explicit __forward_list_base(const __node_allocator& __a) - : __before_begin_(__begin_node(), __a) {} -#ifndef _LIBCPP_CXX03_LANG -public: - _LIBCPP_INLINE_VISIBILITY - __forward_list_base(__forward_list_base&& __x) - _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); - _LIBCPP_INLINE_VISIBILITY - __forward_list_base(__forward_list_base&& __x, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG - -private: - __forward_list_base(const __forward_list_base&); - __forward_list_base& operator=(const __forward_list_base&); - -public: - ~__forward_list_base(); - -protected: - _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __forward_list_base& __x) - {__copy_assign_alloc(__x, integral_constant<bool, - __node_traits::propagate_on_container_copy_assignment::value>());} - - _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__forward_list_base& __x) - _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || - is_nothrow_move_assignable<__node_allocator>::value) - {__move_assign_alloc(__x, integral_constant<bool, - __node_traits::propagate_on_container_move_assignment::value>());} - -public: - _LIBCPP_INLINE_VISIBILITY - void swap(__forward_list_base& __x) -#if _LIBCPP_STD_VER >= 14 - _NOEXCEPT; -#else - _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || - __is_nothrow_swappable<__node_allocator>::value); -#endif -protected: - void clear() _NOEXCEPT; - -private: - _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __forward_list_base&, false_type) {} - _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __forward_list_base& __x, true_type) - { - if (__alloc() != __x.__alloc()) - clear(); - __alloc() = __x.__alloc(); - } - - _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT - {} - _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__forward_list_base& __x, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) - {__alloc() = _VSTD::move(__x.__alloc());} -}; - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -inline -__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) - _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value) - : __before_begin_(_VSTD::move(__x.__before_begin_)) -{ - __x.__before_begin()->__next_ = nullptr; -} - -template <class _Tp, class _Alloc> -inline -__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, - const allocator_type& __a) - : __before_begin_(__begin_node(), __node_allocator(__a)) -{ - if (__alloc() == __x.__alloc()) - { - __before_begin()->__next_ = __x.__before_begin()->__next_; - __x.__before_begin()->__next_ = nullptr; - } -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -__forward_list_base<_Tp, _Alloc>::~__forward_list_base() -{ - clear(); -} - -template <class _Tp, class _Alloc> -inline -void -__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) -#if _LIBCPP_STD_VER >= 14 - _NOEXCEPT -#else - _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || - __is_nothrow_swappable<__node_allocator>::value) -#endif -{ - _VSTD::__swap_allocator(__alloc(), __x.__alloc(), - integral_constant<bool, __node_traits::propagate_on_container_swap::value>()); - using _VSTD::swap; - swap(__before_begin()->__next_, __x.__before_begin()->__next_); -} - -template <class _Tp, class _Alloc> -void -__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT -{ - __node_allocator& __a = __alloc(); - for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) - { - __node_pointer __next = __p->__next_; - __node_traits::destroy(__a, _VSTD::addressof(__p->__value_)); - __node_traits::deallocate(__a, __p, 1); - __p = __next; - } - __before_begin()->__next_ = nullptr; -} - -template <class _Tp, class _Alloc /*= allocator<_Tp>*/> -class _LIBCPP_TEMPLATE_VIS forward_list - : private __forward_list_base<_Tp, _Alloc> -{ - typedef __forward_list_base<_Tp, _Alloc> base; - typedef typename base::__node_allocator __node_allocator; - typedef typename base::__node __node; - typedef typename base::__node_traits __node_traits; - typedef typename base::__node_pointer __node_pointer; - typedef typename base::__begin_node_pointer __begin_node_pointer; - -public: - typedef _Tp value_type; - typedef _Alloc allocator_type; - - static_assert((is_same<typename allocator_type::value_type, value_type>::value), - "Allocator::value_type must be same type as value_type"); - - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; - - typedef typename base::iterator iterator; - typedef typename base::const_iterator const_iterator; -#if _LIBCPP_STD_VER > 17 - typedef size_type __remove_return_type; -#else - typedef void __remove_return_type; -#endif - - _LIBCPP_INLINE_VISIBILITY - forward_list() - _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - {} // = default; - _LIBCPP_INLINE_VISIBILITY - explicit forward_list(const allocator_type& __a); - explicit forward_list(size_type __n); -#if _LIBCPP_STD_VER > 11 - explicit forward_list(size_type __n, const allocator_type& __a); -#endif - forward_list(size_type __n, const value_type& __v); - - template <class = __enable_if_t<__is_allocator<_Alloc>::value> > - forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a) - { - insert_after(cbefore_begin(), __n, __v); - } - - template <class _InputIterator> - forward_list(_InputIterator __f, _InputIterator __l, - typename enable_if< - __is_cpp17_input_iterator<_InputIterator>::value - >::type* = nullptr); - template <class _InputIterator> - forward_list(_InputIterator __f, _InputIterator __l, - const allocator_type& __a, - typename enable_if< - __is_cpp17_input_iterator<_InputIterator>::value - >::type* = nullptr); - forward_list(const forward_list& __x); - forward_list(const forward_list& __x, const __identity_t<allocator_type>& __a); - - forward_list& operator=(const forward_list& __x); - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - forward_list(forward_list&& __x) - _NOEXCEPT_(is_nothrow_move_constructible<base>::value) - : base(_VSTD::move(__x)) {} - forward_list(forward_list&& __x, const __identity_t<allocator_type>& __a); - - forward_list(initializer_list<value_type> __il); - forward_list(initializer_list<value_type> __il, const allocator_type& __a); - - _LIBCPP_INLINE_VISIBILITY - forward_list& operator=(forward_list&& __x) - _NOEXCEPT_( - __node_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); - - _LIBCPP_INLINE_VISIBILITY - forward_list& operator=(initializer_list<value_type> __il); - - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list<value_type> __il); -#endif // _LIBCPP_CXX03_LANG - - // ~forward_list() = default; - - template <class _InputIterator> - typename enable_if - < - __is_cpp17_input_iterator<_InputIterator>::value, - void - >::type - assign(_InputIterator __f, _InputIterator __l); - void assign(size_type __n, const value_type& __v); - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT - {return allocator_type(base::__alloc());} - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT - {return iterator(base::__before_begin()->__next_);} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT - {return const_iterator(base::__before_begin()->__next_);} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT - {return iterator(nullptr);} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT - {return const_iterator(nullptr);} - - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT - {return const_iterator(base::__before_begin()->__next_);} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT - {return const_iterator(nullptr);} - - _LIBCPP_INLINE_VISIBILITY - iterator before_begin() _NOEXCEPT - {return iterator(base::__before_begin());} - _LIBCPP_INLINE_VISIBILITY - const_iterator before_begin() const _NOEXCEPT - {return const_iterator(base::__before_begin());} - _LIBCPP_INLINE_VISIBILITY - const_iterator cbefore_begin() const _NOEXCEPT - {return const_iterator(base::__before_begin());} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT - {return base::__before_begin()->__next_ == nullptr;} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT { - return _VSTD::min<size_type>( - __node_traits::max_size(base::__alloc()), - numeric_limits<difference_type>::max()); - } - - _LIBCPP_INLINE_VISIBILITY - reference front() {return base::__before_begin()->__next_->__value_;} - _LIBCPP_INLINE_VISIBILITY - const_reference front() const {return base::__before_begin()->__next_->__value_;} - -#ifndef _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 14 - template <class... _Args> reference emplace_front(_Args&&... __args); -#else - template <class... _Args> void emplace_front(_Args&&... __args); -#endif - void push_front(value_type&& __v); -#endif // _LIBCPP_CXX03_LANG - void push_front(const value_type& __v); - - void pop_front(); - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args> - iterator emplace_after(const_iterator __p, _Args&&... __args); - - iterator insert_after(const_iterator __p, value_type&& __v); - iterator insert_after(const_iterator __p, initializer_list<value_type> __il) - {return insert_after(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - iterator insert_after(const_iterator __p, const value_type& __v); - iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - __is_cpp17_input_iterator<_InputIterator>::value, - iterator - >::type - insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); - - iterator erase_after(const_iterator __p); - iterator erase_after(const_iterator __f, const_iterator __l); - - _LIBCPP_INLINE_VISIBILITY - void swap(forward_list& __x) -#if _LIBCPP_STD_VER >= 14 - _NOEXCEPT -#else - _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || - __is_nothrow_swappable<__node_allocator>::value) -#endif - {base::swap(__x);} - - void resize(size_type __n); - void resize(size_type __n, const value_type& __v); - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {base::clear();} - - _LIBCPP_INLINE_VISIBILITY - void splice_after(const_iterator __p, forward_list&& __x); - _LIBCPP_INLINE_VISIBILITY - void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i); - _LIBCPP_INLINE_VISIBILITY - void splice_after(const_iterator __p, forward_list&& __x, - const_iterator __f, const_iterator __l); - void splice_after(const_iterator __p, forward_list& __x); - void splice_after(const_iterator __p, forward_list& __x, const_iterator __i); - void splice_after(const_iterator __p, forward_list& __x, - const_iterator __f, const_iterator __l); - __remove_return_type remove(const value_type& __v); - template <class _Predicate> __remove_return_type remove_if(_Predicate __pred); - _LIBCPP_INLINE_VISIBILITY - __remove_return_type unique() {return unique(__equal_to<value_type>());} - template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void merge(forward_list&& __x) {merge(__x, __less<value_type>());} - template <class _Compare> - _LIBCPP_INLINE_VISIBILITY - void merge(forward_list&& __x, _Compare __comp) - {merge(__x, _VSTD::move(__comp));} -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void merge(forward_list& __x) {merge(__x, __less<value_type>());} - template <class _Compare> void merge(forward_list& __x, _Compare __comp); - _LIBCPP_INLINE_VISIBILITY - void sort() {sort(__less<value_type>());} - template <class _Compare> _LIBCPP_INLINE_VISIBILITY void sort(_Compare __comp); - void reverse() _NOEXCEPT; - -private: - -#ifndef _LIBCPP_CXX03_LANG - void __move_assign(forward_list& __x, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); - void __move_assign(forward_list& __x, false_type); -#endif // _LIBCPP_CXX03_LANG - - template <class _Compare> - static - __node_pointer - __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp); - - template <class _Compare> - static - __node_pointer - __sort(__node_pointer __f, difference_type __sz, _Compare& __comp); -}; - - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Alloc = allocator<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Alloc>::value> - > -forward_list(_InputIterator, _InputIterator) - -> forward_list<__iter_value_type<_InputIterator>, _Alloc>; - -template<class _InputIterator, - class _Alloc, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Alloc>::value> - > -forward_list(_InputIterator, _InputIterator, _Alloc) - -> forward_list<__iter_value_type<_InputIterator>, _Alloc>; -#endif - -template <class _Tp, class _Alloc> -inline -forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a) - : base(__a) -{ -} - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(size_type __n) -{ - if (__n > 0) - { - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); - for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, - __p = __p->__next_as_begin()) - { - __h.reset(__node_traits::allocate(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_)); - __h->__next_ = nullptr; - __p->__next_ = __h.release(); - } - } -} - -#if _LIBCPP_STD_VER > 11 -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(size_type __n, - const allocator_type& __base_alloc) - : base ( __base_alloc ) -{ - if (__n > 0) - { - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); - for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, - __p = __p->__next_as_begin()) - { - __h.reset(__node_traits::allocate(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_)); - __h->__next_ = nullptr; - __p->__next_ = __h.release(); - } - } -} -#endif - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) -{ - insert_after(cbefore_begin(), __n, __v); -} - -template <class _Tp, class _Alloc> -template <class _InputIterator> -forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, - typename enable_if< - __is_cpp17_input_iterator<_InputIterator>::value - >::type*) -{ - insert_after(cbefore_begin(), __f, __l); -} - -template <class _Tp, class _Alloc> -template <class _InputIterator> -forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, - const allocator_type& __a, - typename enable_if< - __is_cpp17_input_iterator<_InputIterator>::value - >::type*) - : base(__a) -{ - insert_after(cbefore_begin(), __f, __l); -} - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x) - : base( - __node_traits::select_on_container_copy_construction(__x.__alloc())) { - insert_after(cbefore_begin(), __x.begin(), __x.end()); -} - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, - const __identity_t<allocator_type>& __a) - : base(__a) -{ - insert_after(cbefore_begin(), __x.begin(), __x.end()); -} - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>& -forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) -{ - if (this != _VSTD::addressof(__x)) - { - base::__copy_assign_alloc(__x); - assign(__x.begin(), __x.end()); - } - return *this; -} - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, - const __identity_t<allocator_type>& __a) - : base(_VSTD::move(__x), __a) -{ - if (base::__alloc() != __x.__alloc()) - { - typedef move_iterator<iterator> _Ip; - insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end())); - } -} - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il) -{ - insert_after(cbefore_begin(), __il.begin(), __il.end()); -} - -template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il, - const allocator_type& __a) - : base(__a) -{ - insert_after(cbefore_begin(), __il.begin(), __il.end()); -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) -{ - clear(); - base::__move_assign_alloc(__x); - base::__before_begin()->__next_ = __x.__before_begin()->__next_; - __x.__before_begin()->__next_ = nullptr; -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) -{ - if (base::__alloc() == __x.__alloc()) - __move_assign(__x, true_type()); - else - { - typedef move_iterator<iterator> _Ip; - assign(_Ip(__x.begin()), _Ip(__x.end())); - } -} - -template <class _Tp, class _Alloc> -inline -forward_list<_Tp, _Alloc>& -forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) - _NOEXCEPT_( - __node_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value) -{ - __move_assign(__x, integral_constant<bool, - __node_traits::propagate_on_container_move_assignment::value>()); - return *this; -} - -template <class _Tp, class _Alloc> -inline -forward_list<_Tp, _Alloc>& -forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il) -{ - assign(__il.begin(), __il.end()); - return *this; -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -template <class _InputIterator> -typename enable_if -< - __is_cpp17_input_iterator<_InputIterator>::value, - void ->::type -forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) -{ - iterator __i = before_begin(); - iterator __j = _VSTD::next(__i); - iterator __e = end(); - for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f) - *__j = *__f; - if (__j == __e) - insert_after(__i, __f, __l); - else - erase_after(__i, __e); -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) -{ - iterator __i = before_begin(); - iterator __j = _VSTD::next(__i); - iterator __e = end(); - for (; __j != __e && __n > 0; --__n, ++__i, ++__j) - *__j = __v; - if (__j == __e) - insert_after(__i, __n, __v); - else - erase_after(__i, __e); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -inline -void -forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il) -{ - assign(__il.begin(), __il.end()); -} - -template <class _Tp, class _Alloc> -template <class... _Args> -#if _LIBCPP_STD_VER > 14 -typename forward_list<_Tp, _Alloc>::reference -#else -void -#endif -forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) -{ - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), - _VSTD::forward<_Args>(__args)...); - __h->__next_ = base::__before_begin()->__next_; - base::__before_begin()->__next_ = __h.release(); -#if _LIBCPP_STD_VER > 14 - return base::__before_begin()->__next_->__value_; -#endif -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::push_front(value_type&& __v) -{ - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); - __h->__next_ = base::__before_begin()->__next_; - base::__before_begin()->__next_ = __h.release(); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::push_front(const value_type& __v) -{ - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); - __h->__next_ = base::__before_begin()->__next_; - base::__before_begin()->__next_ = __h.release(); -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::pop_front() -{ - __node_allocator& __a = base::__alloc(); - __node_pointer __p = base::__before_begin()->__next_; - base::__before_begin()->__next_ = __p->__next_; - __node_traits::destroy(__a, _VSTD::addressof(__p->__value_)); - __node_traits::deallocate(__a, __p, 1); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -template <class... _Args> -typename forward_list<_Tp, _Alloc>::iterator -forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) -{ - __begin_node_pointer const __r = __p.__get_begin(); - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), - _VSTD::forward<_Args>(__args)...); - __h->__next_ = __r->__next_; - __r->__next_ = __h.release(); - return iterator(__r->__next_); -} - -template <class _Tp, class _Alloc> -typename forward_list<_Tp, _Alloc>::iterator -forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) -{ - __begin_node_pointer const __r = __p.__get_begin(); - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); - __h->__next_ = __r->__next_; - __r->__next_ = __h.release(); - return iterator(__r->__next_); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -typename forward_list<_Tp, _Alloc>::iterator -forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v) -{ - __begin_node_pointer const __r = __p.__get_begin(); - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); - __h->__next_ = __r->__next_; - __r->__next_ = __h.release(); - return iterator(__r->__next_); -} - -template <class _Tp, class _Alloc> -typename forward_list<_Tp, _Alloc>::iterator -forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, - const value_type& __v) -{ - __begin_node_pointer __r = __p.__get_begin(); - if (__n > 0) - { - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); - __node_pointer __first = __h.release(); - __node_pointer __last = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { -#endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, __last = __last->__next_) - { - __h.reset(__node_traits::allocate(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); - __last->__next_ = __h.release(); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - while (__first != nullptr) - { - __node_pointer __next = __first->__next_; - __node_traits::destroy(__a, _VSTD::addressof(__first->__value_)); - __node_traits::deallocate(__a, __first, 1); - __first = __next; - } - throw; - } -#endif // _LIBCPP_NO_EXCEPTIONS - __last->__next_ = __r->__next_; - __r->__next_ = __first; - __r = static_cast<__begin_node_pointer>(__last); - } - return iterator(__r); -} - -template <class _Tp, class _Alloc> -template <class _InputIterator> -typename enable_if -< - __is_cpp17_input_iterator<_InputIterator>::value, - typename forward_list<_Tp, _Alloc>::iterator ->::type -forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, - _InputIterator __f, _InputIterator __l) -{ - __begin_node_pointer __r = __p.__get_begin(); - if (__f != __l) - { - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); - __node_pointer __first = __h.release(); - __node_pointer __last = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { -#endif // _LIBCPP_NO_EXCEPTIONS - for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) - { - __h.reset(__node_traits::allocate(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); - __last->__next_ = __h.release(); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - while (__first != nullptr) - { - __node_pointer __next = __first->__next_; - __node_traits::destroy(__a, _VSTD::addressof(__first->__value_)); - __node_traits::deallocate(__a, __first, 1); - __first = __next; - } - throw; - } -#endif // _LIBCPP_NO_EXCEPTIONS - __last->__next_ = __r->__next_; - __r->__next_ = __first; - __r = static_cast<__begin_node_pointer>(__last); - } - return iterator(__r); -} - -template <class _Tp, class _Alloc> -typename forward_list<_Tp, _Alloc>::iterator -forward_list<_Tp, _Alloc>::erase_after(const_iterator __f) -{ - __begin_node_pointer __p = __f.__get_begin(); - __node_pointer __n = __p->__next_; - __p->__next_ = __n->__next_; - __node_allocator& __a = base::__alloc(); - __node_traits::destroy(__a, _VSTD::addressof(__n->__value_)); - __node_traits::deallocate(__a, __n, 1); - return iterator(__p->__next_); -} - -template <class _Tp, class _Alloc> -typename forward_list<_Tp, _Alloc>::iterator -forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l) -{ - __node_pointer __e = __l.__get_unsafe_node_pointer(); - if (__f != __l) - { - __begin_node_pointer __bp = __f.__get_begin(); - - __node_pointer __n = __bp->__next_; - if (__n != __e) - { - __bp->__next_ = __e; - __node_allocator& __a = base::__alloc(); - do - { - __node_pointer __tmp = __n->__next_; - __node_traits::destroy(__a, _VSTD::addressof(__n->__value_)); - __node_traits::deallocate(__a, __n, 1); - __n = __tmp; - } while (__n != __e); - } - } - return iterator(__e); -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::resize(size_type __n) -{ - size_type __sz = 0; - iterator __p = before_begin(); - iterator __i = begin(); - iterator __e = end(); - for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz) - ; - if (__i != __e) - erase_after(__p, __e); - else - { - __n -= __sz; - if (__n > 0) - { - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); - for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, - __ptr = __ptr->__next_as_begin()) - { - __h.reset(__node_traits::allocate(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_)); - __h->__next_ = nullptr; - __ptr->__next_ = __h.release(); - } - } - } -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v) -{ - size_type __sz = 0; - iterator __p = before_begin(); - iterator __i = begin(); - iterator __e = end(); - for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz) - ; - if (__i != __e) - erase_after(__p, __e); - else - { - __n -= __sz; - if (__n > 0) - { - __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _Dp; - unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); - for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, - __ptr = __ptr->__next_as_begin()) - { - __h.reset(__node_traits::allocate(__a, 1)); - __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); - __h->__next_ = nullptr; - __ptr->__next_ = __h.release(); - } - } - } -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, - forward_list& __x) -{ - if (!__x.empty()) - { - if (__p.__get_begin()->__next_ != nullptr) - { - const_iterator __lm1 = __x.before_begin(); - while (__lm1.__get_begin()->__next_ != nullptr) - ++__lm1; - __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; - } - __p.__get_begin()->__next_ = __x.__before_begin()->__next_; - __x.__before_begin()->__next_ = nullptr; - } -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, - forward_list& /*__other*/, - const_iterator __i) -{ - const_iterator __lm1 = _VSTD::next(__i); - if (__p != __i && __p != __lm1) - { - __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_; - __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; - __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer(); - } -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, - forward_list& /*__other*/, - const_iterator __f, const_iterator __l) -{ - if (__f != __l && __p != __f) - { - const_iterator __lm1 = __f; - while (__lm1.__get_begin()->__next_ != __l.__get_begin()) - ++__lm1; - if (__f != __lm1) - { - __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; - __p.__get_begin()->__next_ = __f.__get_begin()->__next_; - __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer(); - } - } -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, - forward_list&& __x) -{ - splice_after(__p, __x); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, - forward_list&& __x, - const_iterator __i) -{ - splice_after(__p, __x, __i); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, - forward_list&& __x, - const_iterator __f, const_iterator __l) -{ - splice_after(__p, __x, __f, __l); -} - -template <class _Tp, class _Alloc> -typename forward_list<_Tp, _Alloc>::__remove_return_type -forward_list<_Tp, _Alloc>::remove(const value_type& __v) -{ - forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing - typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; - const iterator __e = end(); - for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) - { - if (__i.__get_begin()->__next_->__value_ == __v) - { - ++__count_removed; - iterator __j = _VSTD::next(__i, 2); - for (; __j != __e && *__j == __v; ++__j) - ++__count_removed; - __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); - if (__j == __e) - break; - __i = __j; - } - else - ++__i; - } - - return (__remove_return_type) __count_removed; -} - -template <class _Tp, class _Alloc> -template <class _Predicate> -typename forward_list<_Tp, _Alloc>::__remove_return_type -forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) -{ - forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing - typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; - const iterator __e = end(); - for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) - { - if (__pred(__i.__get_begin()->__next_->__value_)) - { - ++__count_removed; - iterator __j = _VSTD::next(__i, 2); - for (; __j != __e && __pred(*__j); ++__j) - ++__count_removed; - __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); - if (__j == __e) - break; - __i = __j; - } - else - ++__i; - } - - return (__remove_return_type) __count_removed; -} - -template <class _Tp, class _Alloc> -template <class _BinaryPredicate> -typename forward_list<_Tp, _Alloc>::__remove_return_type -forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) -{ - forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing - typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; - for (iterator __i = begin(), __e = end(); __i != __e;) - { - iterator __j = _VSTD::next(__i); - for (; __j != __e && __binary_pred(*__i, *__j); ++__j) - ++__count_removed; - if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer()) - __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); - __i = __j; - } - - return (__remove_return_type) __count_removed; -} - -template <class _Tp, class _Alloc> -template <class _Compare> -void -forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp) -{ - if (this != _VSTD::addressof(__x)) - { - base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_, - __x.__before_begin()->__next_, - __comp); - __x.__before_begin()->__next_ = nullptr; - } -} - -template <class _Tp, class _Alloc> -template <class _Compare> -typename forward_list<_Tp, _Alloc>::__node_pointer -forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2, - _Compare& __comp) -{ - if (__f1 == nullptr) - return __f2; - if (__f2 == nullptr) - return __f1; - __node_pointer __r; - if (__comp(__f2->__value_, __f1->__value_)) - { - __node_pointer __t = __f2; - while (__t->__next_ != nullptr && - __comp(__t->__next_->__value_, __f1->__value_)) - __t = __t->__next_; - __r = __f2; - __f2 = __t->__next_; - __t->__next_ = __f1; - } - else - __r = __f1; - __node_pointer __p = __f1; - __f1 = __f1->__next_; - while (__f1 != nullptr && __f2 != nullptr) - { - if (__comp(__f2->__value_, __f1->__value_)) - { - __node_pointer __t = __f2; - while (__t->__next_ != nullptr && - __comp(__t->__next_->__value_, __f1->__value_)) - __t = __t->__next_; - __p->__next_ = __f2; - __f2 = __t->__next_; - __t->__next_ = __f1; - } - __p = __f1; - __f1 = __f1->__next_; - } - if (__f2 != nullptr) - __p->__next_ = __f2; - return __r; -} - -template <class _Tp, class _Alloc> -template <class _Compare> -inline -void -forward_list<_Tp, _Alloc>::sort(_Compare __comp) -{ - base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, - _VSTD::distance(begin(), end()), __comp); -} - -template <class _Tp, class _Alloc> -template <class _Compare> -typename forward_list<_Tp, _Alloc>::__node_pointer -forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz, - _Compare& __comp) -{ - switch (__sz) - { - case 0: - case 1: - return __f1; - case 2: - if (__comp(__f1->__next_->__value_, __f1->__value_)) - { - __node_pointer __t = __f1->__next_; - __t->__next_ = __f1; - __f1->__next_ = nullptr; - __f1 = __t; - } - return __f1; - } - difference_type __sz1 = __sz / 2; - difference_type __sz2 = __sz - __sz1; - __node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer(); - __node_pointer __f2 = __t->__next_; - __t->__next_ = nullptr; - return __merge(__sort(__f1, __sz1, __comp), - __sort(__f2, __sz2, __comp), __comp); -} - -template <class _Tp, class _Alloc> -void -forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT -{ - __node_pointer __p = base::__before_begin()->__next_; - if (__p != nullptr) - { - __node_pointer __f = __p->__next_; - __p->__next_ = nullptr; - while (__f != nullptr) - { - __node_pointer __t = __f->__next_; - __f->__next_ = __p; - __p = __f; - __f = __t; - } - base::__before_begin()->__next_ = __p; - } -} - -template <class _Tp, class _Alloc> -bool operator==(const forward_list<_Tp, _Alloc>& __x, - const forward_list<_Tp, _Alloc>& __y) -{ - typedef forward_list<_Tp, _Alloc> _Cp; - typedef typename _Cp::const_iterator _Ip; - _Ip __ix = __x.begin(); - _Ip __ex = __x.end(); - _Ip __iy = __y.begin(); - _Ip __ey = __y.end(); - for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) - if (!(*__ix == *__iy)) - return false; - return (__ix == __ex) == (__iy == __ey); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(const forward_list<_Tp, _Alloc>& __x, - const forward_list<_Tp, _Alloc>& __y) -{ - return !(__x == __y); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool operator< (const forward_list<_Tp, _Alloc>& __x, - const forward_list<_Tp, _Alloc>& __y) -{ - return _VSTD::lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool operator> (const forward_list<_Tp, _Alloc>& __x, - const forward_list<_Tp, _Alloc>& __y) -{ - return __y < __x; -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool operator>=(const forward_list<_Tp, _Alloc>& __x, - const forward_list<_Tp, _Alloc>& __y) -{ - return !(__x < __y); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool operator<=(const forward_list<_Tp, _Alloc>& __x, - const forward_list<_Tp, _Alloc>& __y) -{ - return !(__y < __x); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Tp, class _Allocator, class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename forward_list<_Tp, _Allocator>::size_type - erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) { - return __c.remove_if(__pred); -} - -template <class _Tp, class _Allocator, class _Up> -inline _LIBCPP_INLINE_VISIBILITY - typename forward_list<_Tp, _Allocator>::size_type - erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) { - return _VSTD::erase_if(__c, [&](auto& __elem) { return __elem == __v; }); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FORWARD_LIST diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h b/contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h deleted file mode 100644 index 5873e3f647..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/inttypes.h +++ /dev/null @@ -1,266 +0,0 @@ -// -*- 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_INTTYPES_H -// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T -// is defined until an inclusion of it without _STD_TYPES_T occurs, in which -// case the header guard macro is defined. -#if !defined(_AIX) || !defined(_STD_TYPES_T) -#define _LIBCPP_INTTYPES_H -#endif // _STD_TYPES_T - -/* - inttypes.h synopsis - -This entire header is C99 / C++0X - -#include <stdint.h> // <cinttypes> includes <cstdint> - -Macros: - - PRId8 - PRId16 - PRId32 - PRId64 - - PRIdLEAST8 - PRIdLEAST16 - PRIdLEAST32 - PRIdLEAST64 - - PRIdFAST8 - PRIdFAST16 - PRIdFAST32 - PRIdFAST64 - - PRIdMAX - PRIdPTR - - PRIi8 - PRIi16 - PRIi32 - PRIi64 - - PRIiLEAST8 - PRIiLEAST16 - PRIiLEAST32 - PRIiLEAST64 - - PRIiFAST8 - PRIiFAST16 - PRIiFAST32 - PRIiFAST64 - - PRIiMAX - PRIiPTR - - PRIo8 - PRIo16 - PRIo32 - PRIo64 - - PRIoLEAST8 - PRIoLEAST16 - PRIoLEAST32 - PRIoLEAST64 - - PRIoFAST8 - PRIoFAST16 - PRIoFAST32 - PRIoFAST64 - - PRIoMAX - PRIoPTR - - PRIu8 - PRIu16 - PRIu32 - PRIu64 - - PRIuLEAST8 - PRIuLEAST16 - PRIuLEAST32 - PRIuLEAST64 - - PRIuFAST8 - PRIuFAST16 - PRIuFAST32 - PRIuFAST64 - - PRIuMAX - PRIuPTR - - PRIx8 - PRIx16 - PRIx32 - PRIx64 - - PRIxLEAST8 - PRIxLEAST16 - PRIxLEAST32 - PRIxLEAST64 - - PRIxFAST8 - PRIxFAST16 - PRIxFAST32 - PRIxFAST64 - - PRIxMAX - PRIxPTR - - PRIX8 - PRIX16 - PRIX32 - PRIX64 - - PRIXLEAST8 - PRIXLEAST16 - PRIXLEAST32 - PRIXLEAST64 - - PRIXFAST8 - PRIXFAST16 - PRIXFAST32 - PRIXFAST64 - - PRIXMAX - PRIXPTR - - SCNd8 - SCNd16 - SCNd32 - SCNd64 - - SCNdLEAST8 - SCNdLEAST16 - SCNdLEAST32 - SCNdLEAST64 - - SCNdFAST8 - SCNdFAST16 - SCNdFAST32 - SCNdFAST64 - - SCNdMAX - SCNdPTR - - SCNi8 - SCNi16 - SCNi32 - SCNi64 - - SCNiLEAST8 - SCNiLEAST16 - SCNiLEAST32 - SCNiLEAST64 - - SCNiFAST8 - SCNiFAST16 - SCNiFAST32 - SCNiFAST64 - - SCNiMAX - SCNiPTR - - SCNo8 - SCNo16 - SCNo32 - SCNo64 - - SCNoLEAST8 - SCNoLEAST16 - SCNoLEAST32 - SCNoLEAST64 - - SCNoFAST8 - SCNoFAST16 - SCNoFAST32 - SCNoFAST64 - - SCNoMAX - SCNoPTR - - SCNu8 - SCNu16 - SCNu32 - SCNu64 - - SCNuLEAST8 - SCNuLEAST16 - SCNuLEAST32 - SCNuLEAST64 - - SCNuFAST8 - SCNuFAST16 - SCNuFAST32 - SCNuFAST64 - - SCNuMAX - SCNuPTR - - SCNx8 - SCNx16 - SCNx32 - SCNx64 - - SCNxLEAST8 - SCNxLEAST16 - SCNxLEAST32 - SCNxLEAST64 - - SCNxFAST8 - SCNxFAST16 - SCNxFAST32 - SCNxFAST64 - - SCNxMAX - SCNxPTR - -Types: - - imaxdiv_t - -intmax_t imaxabs(intmax_t j); -imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); -intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base); -uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base); -intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); -uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed - for C++11 unless __STDC_FORMAT_MACROS is defined -*/ -#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) -# define __STDC_FORMAT_MACROS -#endif - -#ifdef _LIBCPP_COMPILER_MSVC -#include Y_UCRT_INCLUDE_NEXT(inttypes.h) -#else -#include_next <inttypes.h> -#endif - -#ifdef __cplusplus - -#include <stdint.h> - -#undef imaxabs -#undef imaxdiv - -#endif // __cplusplus - -#endif // _LIBCPP_INTTYPES_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/iostream b/contrib/libs/cxxsupp/libcxxmsvc/include/iostream deleted file mode 100644 index dbabf3ad32..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/iostream +++ /dev/null @@ -1,89 +0,0 @@ -// -*- 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_IOSTREAM -#define _LIBCPP_IOSTREAM - -/* - iostream synopsis - -#include <ios> -#include <istream> -#include <ostream> -#include <streambuf> - -namespace std { - -extern istream cin; -extern ostream cout; -extern ostream cerr; -extern ostream clog; -extern wistream wcin; -extern wostream wcout; -extern wostream wcerr; -extern wostream wclog; - -} // std - -*/ - -#include <__config> -#include <ios> -#include <istream> -#include <ostream> -#include <streambuf> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if defined(_MSC_VER) && !defined(__clang__) -extern _LIBCPP_FUNC_VIS istream& cin; -#else -extern _LIBCPP_FUNC_VIS istream cin; -#endif -#if defined(_MSC_VER) && !defined(__clang__) -extern _LIBCPP_FUNC_VIS ostream& cout; -#else -extern _LIBCPP_FUNC_VIS ostream cout; -#endif -#if defined(_MSC_VER) && !defined(__clang__) -extern _LIBCPP_FUNC_VIS ostream& cerr; -extern _LIBCPP_FUNC_VIS ostream& clog; -#else -extern _LIBCPP_FUNC_VIS ostream cerr; -extern _LIBCPP_FUNC_VIS ostream clog; -#endif - -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -#if defined(_MSC_VER) && !defined(__clang__) -extern _LIBCPP_FUNC_VIS wistream& wcin; -#else -extern _LIBCPP_FUNC_VIS wistream wcin; -#endif -#if defined(_MSC_VER) && !defined(__clang__) -extern _LIBCPP_FUNC_VIS wostream& wcout; -#else -extern _LIBCPP_FUNC_VIS wostream wcout; -#endif -#if defined(_MSC_VER) && !defined(__clang__) -extern _LIBCPP_FUNC_VIS wostream& wcerr; -extern _LIBCPP_FUNC_VIS wostream& wclog; -#else -extern _LIBCPP_FUNC_VIS wostream wcerr; -extern _LIBCPP_FUNC_VIS wostream wclog; -#endif -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_IOSTREAM diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/list b/contrib/libs/cxxsupp/libcxxmsvc/include/list deleted file mode 100644 index b1f6c57007..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/list +++ /dev/null @@ -1,2422 +0,0 @@ -// -*- 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_LIST -#define _LIBCPP_LIST - -/* - list synopsis - -namespace std -{ - -template <class T, class Alloc = allocator<T> > -class list -{ -public: - - // types: - typedef T value_type; - typedef Alloc allocator_type; - typedef typename allocator_type::reference reference; - typedef typename allocator_type::const_reference const_reference; - typedef typename allocator_type::pointer pointer; - typedef typename allocator_type::const_pointer const_pointer; - typedef implementation-defined iterator; - typedef implementation-defined const_iterator; - typedef implementation-defined size_type; - typedef implementation-defined difference_type; - typedef reverse_iterator<iterator> reverse_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - - list() - noexcept(is_nothrow_default_constructible<allocator_type>::value); - explicit list(const allocator_type& a); - explicit list(size_type n); - explicit list(size_type n, const allocator_type& a); // C++14 - list(size_type n, const value_type& value); - list(size_type n, const value_type& value, const allocator_type& a); - template <class Iter> - list(Iter first, Iter last); - template <class Iter> - list(Iter first, Iter last, const allocator_type& a); - list(const list& x); - list(const list&, const allocator_type& a); - list(list&& x) - noexcept(is_nothrow_move_constructible<allocator_type>::value); - list(list&&, const allocator_type& a); - list(initializer_list<value_type>); - list(initializer_list<value_type>, const allocator_type& a); - - ~list(); - - list& operator=(const list& x); - list& operator=(list&& x) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); - list& operator=(initializer_list<value_type>); - template <class Iter> - void assign(Iter first, Iter last); - void assign(size_type n, const value_type& t); - void assign(initializer_list<value_type>); - - allocator_type get_allocator() const noexcept; - - iterator begin() noexcept; - const_iterator begin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; - reverse_iterator rbegin() noexcept; - const_reverse_iterator rbegin() const noexcept; - reverse_iterator rend() noexcept; - const_reverse_iterator rend() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - const_reverse_iterator crbegin() const noexcept; - const_reverse_iterator crend() const noexcept; - - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - template <class... Args> - reference emplace_front(Args&&... args); // reference in C++17 - void pop_front(); - template <class... Args> - reference emplace_back(Args&&... args); // reference in C++17 - void pop_back(); - void push_front(const value_type& x); - void push_front(value_type&& x); - void push_back(const value_type& x); - void push_back(value_type&& x); - template <class... Args> - iterator emplace(const_iterator position, Args&&... args); - iterator insert(const_iterator position, const value_type& x); - iterator insert(const_iterator position, value_type&& x); - iterator insert(const_iterator position, size_type n, const value_type& x); - template <class Iter> - iterator insert(const_iterator position, Iter first, Iter last); - iterator insert(const_iterator position, initializer_list<value_type> il); - - iterator erase(const_iterator position); - iterator erase(const_iterator position, const_iterator last); - - void resize(size_type sz); - void resize(size_type sz, const value_type& c); - - void swap(list&) - noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17 - void clear() noexcept; - - void splice(const_iterator position, list& x); - void splice(const_iterator position, list&& x); - void splice(const_iterator position, list& x, const_iterator i); - void splice(const_iterator position, list&& x, const_iterator i); - void splice(const_iterator position, list& x, const_iterator first, - const_iterator last); - void splice(const_iterator position, list&& x, const_iterator first, - const_iterator last); - - size_type remove(const value_type& value); // void before C++20 - template <class Pred> - size_type remove_if(Pred pred); // void before C++20 - size_type unique(); // void before C++20 - template <class BinaryPredicate> - size_type unique(BinaryPredicate binary_pred); // void before C++20 - void merge(list& x); - void merge(list&& x); - template <class Compare> - void merge(list& x, Compare comp); - template <class Compare> - void merge(list&& x, Compare comp); - void sort(); - template <class Compare> - void sort(Compare comp); - void reverse() noexcept; -}; - - -template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> - list(InputIterator, InputIterator, Allocator = Allocator()) - -> list<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17 - -template <class T, class Alloc> - bool operator==(const list<T,Alloc>& x, const list<T,Alloc>& y); -template <class T, class Alloc> - bool operator< (const list<T,Alloc>& x, const list<T,Alloc>& y); -template <class T, class Alloc> - bool operator!=(const list<T,Alloc>& x, const list<T,Alloc>& y); -template <class T, class Alloc> - bool operator> (const list<T,Alloc>& x, const list<T,Alloc>& y); -template <class T, class Alloc> - bool operator>=(const list<T,Alloc>& x, const list<T,Alloc>& y); -template <class T, class Alloc> - bool operator<=(const list<T,Alloc>& x, const list<T,Alloc>& y); - -template <class T, class Alloc> - void swap(list<T,Alloc>& x, list<T,Alloc>& y) - noexcept(noexcept(x.swap(y))); - -template <class T, class Allocator, class U> - typename list<T, Allocator>::size_type - erase(list<T, Allocator>& c, const U& value); // C++20 -template <class T, class Allocator, class Predicate> - typename list<T, Allocator>::size_type - erase_if(list<T, Allocator>& c, Predicate pred); // C++20 - -} // std - -*/ - -#include <__algorithm/comp.h> -#include <__algorithm/equal.h> -#include <__algorithm/lexicographical_compare.h> -#include <__algorithm/min.h> -#include <__assert> -#include <__config> -#include <__debug> -#include <__utility/forward.h> -#include <initializer_list> -#include <iterator> -#include <limits> -#include <memory> -#include <type_traits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp, class _VoidPtr> struct __list_node; -template <class _Tp, class _VoidPtr> struct __list_node_base; - -template <class _Tp, class _VoidPtr> -struct __list_node_pointer_traits { - typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type - __node_pointer; - typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type - __base_pointer; - -#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB) - typedef __base_pointer __link_pointer; -#else - typedef typename conditional< - is_pointer<_VoidPtr>::value, - __base_pointer, - __node_pointer - >::type __link_pointer; -#endif - - typedef typename conditional< - is_same<__link_pointer, __node_pointer>::value, - __base_pointer, - __node_pointer - >::type __non_link_pointer; - - static _LIBCPP_INLINE_VISIBILITY - __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { - return __p; - } - - static _LIBCPP_INLINE_VISIBILITY - __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) { - return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p)); - } - -}; - -template <class _Tp, class _VoidPtr> -struct __list_node_base -{ - typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; - typedef typename _NodeTraits::__node_pointer __node_pointer; - typedef typename _NodeTraits::__base_pointer __base_pointer; - typedef typename _NodeTraits::__link_pointer __link_pointer; - - __link_pointer __prev_; - __link_pointer __next_; - - _LIBCPP_INLINE_VISIBILITY - __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())), - __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {} - - _LIBCPP_INLINE_VISIBILITY - __base_pointer __self() { - return pointer_traits<__base_pointer>::pointer_to(*this); - } - - _LIBCPP_INLINE_VISIBILITY - __node_pointer __as_node() { - return static_cast<__node_pointer>(__self()); - } -}; - -template <class _Tp, class _VoidPtr> -struct _LIBCPP_STANDALONE_DEBUG __list_node - : public __list_node_base<_Tp, _VoidPtr> -{ - _Tp __value_; - - typedef __list_node_base<_Tp, _VoidPtr> __base; - typedef typename __base::__link_pointer __link_pointer; - - _LIBCPP_INLINE_VISIBILITY - __link_pointer __as_link() { - return static_cast<__link_pointer>(__base::__self()); - } -}; - -template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS list; -template <class _Tp, class _Alloc> class __list_imp; -template <class _Tp, class _VoidPtr> class _LIBCPP_TEMPLATE_VIS __list_const_iterator; - -template <class _Tp, class _VoidPtr> -class _LIBCPP_TEMPLATE_VIS __list_iterator -{ - typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; - typedef typename _NodeTraits::__link_pointer __link_pointer; - - __link_pointer __ptr_; - -#if _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT - : __ptr_(__p) - { - __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} -#endif - - - - template<class, class> friend class list; - template<class, class> friend class __list_imp; - template<class, class> friend class __list_const_iterator; -public: - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef value_type& reference; - typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer; - typedef typename pointer_traits<pointer>::difference_type difference_type; - - _LIBCPP_INLINE_VISIBILITY - __list_iterator() _NOEXCEPT : __ptr_(nullptr) - { - _VSTD::__debug_db_insert_i(this); - } - -#if _LIBCPP_DEBUG_LEVEL == 2 - - _LIBCPP_INLINE_VISIBILITY - __list_iterator(const __list_iterator& __p) - : __ptr_(__p.__ptr_) - { - __get_db()->__iterator_copy(this, _VSTD::addressof(__p)); - } - - _LIBCPP_INLINE_VISIBILITY - ~__list_iterator() - { - __get_db()->__erase_i(this); - } - - _LIBCPP_INLINE_VISIBILITY - __list_iterator& operator=(const __list_iterator& __p) - { - if (this != _VSTD::addressof(__p)) - { - __get_db()->__iterator_copy(this, _VSTD::addressof(__p)); - __ptr_ = __p.__ptr_; - } - return *this; - } - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - - _LIBCPP_INLINE_VISIBILITY - reference operator*() const - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), - "Attempted to dereference a non-dereferenceable list::iterator"); - return __ptr_->__as_node()->__value_; - } - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), - "Attempted to dereference a non-dereferenceable list::iterator"); - return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_); - } - - _LIBCPP_INLINE_VISIBILITY - __list_iterator& operator++() - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), - "Attempted to increment a non-incrementable list::iterator"); - __ptr_ = __ptr_->__next_; - return *this; - } - _LIBCPP_INLINE_VISIBILITY - __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;} - - _LIBCPP_INLINE_VISIBILITY - __list_iterator& operator--() - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this), - "Attempted to decrement a non-decrementable list::iterator"); - __ptr_ = __ptr_->__prev_; - return *this; - } - _LIBCPP_INLINE_VISIBILITY - __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;} - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const __list_iterator& __x, const __list_iterator& __y) - { - return __x.__ptr_ == __y.__ptr_; - } - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const __list_iterator& __x, const __list_iterator& __y) - {return !(__x == __y);} -}; - -template <class _Tp, class _VoidPtr> -class _LIBCPP_TEMPLATE_VIS __list_const_iterator -{ - typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; - typedef typename _NodeTraits::__link_pointer __link_pointer; - - __link_pointer __ptr_; - -#if _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT - : __ptr_(__p) - { - __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} -#endif - - template<class, class> friend class list; - template<class, class> friend class __list_imp; -public: - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef const value_type& reference; - typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer; - typedef typename pointer_traits<pointer>::difference_type difference_type; - - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator() _NOEXCEPT : __ptr_(nullptr) - { - _VSTD::__debug_db_insert_i(this); - } - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT - : __ptr_(__p.__ptr_) - { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__iterator_copy(this, _VSTD::addressof(__p)); -#endif - } - -#if _LIBCPP_DEBUG_LEVEL == 2 - - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator(const __list_const_iterator& __p) - : __ptr_(__p.__ptr_) - { - __get_db()->__iterator_copy(this, _VSTD::addressof(__p)); - } - - _LIBCPP_INLINE_VISIBILITY - ~__list_const_iterator() - { - __get_db()->__erase_i(this); - } - - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator& operator=(const __list_const_iterator& __p) - { - if (this != _VSTD::addressof(__p)) - { - __get_db()->__iterator_copy(this, _VSTD::addressof(__p)); - __ptr_ = __p.__ptr_; - } - return *this; - } - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY - reference operator*() const - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), - "Attempted to dereference a non-dereferenceable list::const_iterator"); - return __ptr_->__as_node()->__value_; - } - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), - "Attempted to dereference a non-dereferenceable list::const_iterator"); - return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_); - } - - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator& operator++() - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), - "Attempted to increment a non-incrementable list::const_iterator"); - __ptr_ = __ptr_->__next_; - return *this; - } - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;} - - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator& operator--() - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this), - "Attempted to decrement a non-decrementable list::const_iterator"); - __ptr_ = __ptr_->__prev_; - return *this; - } - _LIBCPP_INLINE_VISIBILITY - __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;} - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) - { - return __x.__ptr_ == __y.__ptr_; - } - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y) - {return !(__x == __y);} -}; - -template <class _Tp, class _Alloc> -class __list_imp -{ - __list_imp(const __list_imp&); - __list_imp& operator=(const __list_imp&); -public: - typedef _Alloc allocator_type; - typedef allocator_traits<allocator_type> __alloc_traits; - typedef typename __alloc_traits::size_type size_type; -protected: - typedef _Tp value_type; - typedef typename __alloc_traits::void_pointer __void_pointer; - typedef __list_iterator<value_type, __void_pointer> iterator; - typedef __list_const_iterator<value_type, __void_pointer> const_iterator; - typedef __list_node_base<value_type, __void_pointer> __node_base; - typedef __list_node<value_type, __void_pointer> __node; - typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; - typedef allocator_traits<__node_allocator> __node_alloc_traits; - typedef typename __node_alloc_traits::pointer __node_pointer; - typedef typename __node_alloc_traits::pointer __node_const_pointer; - typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits; - typedef typename __node_pointer_traits::__link_pointer __link_pointer; - typedef __link_pointer __link_const_pointer; - typedef typename __alloc_traits::pointer pointer; - typedef typename __alloc_traits::const_pointer const_pointer; - typedef typename __alloc_traits::difference_type difference_type; - - typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator; - typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer; - static_assert((!is_same<allocator_type, __node_allocator>::value), - "internal allocator type must differ from user-specified " - "type; otherwise overload resolution breaks"); - - __node_base __end_; - __compressed_pair<size_type, __node_allocator> __size_alloc_; - - _LIBCPP_INLINE_VISIBILITY - __link_pointer __end_as_link() const _NOEXCEPT { - return __node_pointer_traits::__unsafe_link_pointer_cast( - const_cast<__node_base&>(__end_).__self()); - } - - _LIBCPP_INLINE_VISIBILITY - size_type& __sz() _NOEXCEPT {return __size_alloc_.first();} - _LIBCPP_INLINE_VISIBILITY - const size_type& __sz() const _NOEXCEPT - {return __size_alloc_.first();} - _LIBCPP_INLINE_VISIBILITY - __node_allocator& __node_alloc() _NOEXCEPT - {return __size_alloc_.second();} - _LIBCPP_INLINE_VISIBILITY - const __node_allocator& __node_alloc() const _NOEXCEPT - {return __size_alloc_.second();} - - _LIBCPP_INLINE_VISIBILITY - size_type __node_alloc_max_size() const _NOEXCEPT { - return __node_alloc_traits::max_size(__node_alloc()); - } - _LIBCPP_INLINE_VISIBILITY - static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY - __list_imp() - _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value); - _LIBCPP_INLINE_VISIBILITY - __list_imp(const allocator_type& __a); - _LIBCPP_INLINE_VISIBILITY - __list_imp(const __node_allocator& __a); -#ifndef _LIBCPP_CXX03_LANG - __list_imp(__node_allocator&& __a) _NOEXCEPT; -#endif - ~__list_imp(); - void clear() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __sz() == 0;} - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT - { -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__end_.__next_, this); -#else - return iterator(__end_.__next_); -#endif - } - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT - { -#if _LIBCPP_DEBUG_LEVEL == 2 - return const_iterator(__end_.__next_, this); -#else - return const_iterator(__end_.__next_); -#endif - } - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT - { -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__end_as_link(), this); -#else - return iterator(__end_as_link()); -#endif - } - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT - { -#if _LIBCPP_DEBUG_LEVEL == 2 - return const_iterator(__end_as_link(), this); -#else - return const_iterator(__end_as_link()); -#endif - } - - void swap(__list_imp& __c) -#if _LIBCPP_STD_VER >= 14 - _NOEXCEPT; -#else - _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || - __is_nothrow_swappable<allocator_type>::value); -#endif - - _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __list_imp& __c) - {__copy_assign_alloc(__c, integral_constant<bool, - __node_alloc_traits::propagate_on_container_copy_assignment::value>());} - - _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__list_imp& __c) - _NOEXCEPT_( - !__node_alloc_traits::propagate_on_container_move_assignment::value || - is_nothrow_move_assignable<__node_allocator>::value) - {__move_assign_alloc(__c, integral_constant<bool, - __node_alloc_traits::propagate_on_container_move_assignment::value>());} - -private: - _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __list_imp& __c, true_type) - { - if (__node_alloc() != __c.__node_alloc()) - clear(); - __node_alloc() = __c.__node_alloc(); - } - - _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __list_imp&, false_type) - {} - - _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__list_imp& __c, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) - { - __node_alloc() = _VSTD::move(__c.__node_alloc()); - } - - _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__list_imp&, false_type) - _NOEXCEPT - {} - - _LIBCPP_INLINE_VISIBILITY - void __invalidate_all_iterators() { -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__invalidate_all(this); -#endif - } -}; - -// Unlink nodes [__f, __l] -template <class _Tp, class _Alloc> -inline -void -__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) - _NOEXCEPT -{ - __f->__prev_->__next_ = __l->__next_; - __l->__next_->__prev_ = __f->__prev_; -} - -template <class _Tp, class _Alloc> -inline -__list_imp<_Tp, _Alloc>::__list_imp() - _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - : __size_alloc_(0, __default_init_tag()) -{ -} - -template <class _Tp, class _Alloc> -inline -__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) - : __size_alloc_(0, __node_allocator(__a)) -{ -} - -template <class _Tp, class _Alloc> -inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) - : __size_alloc_(0, __a) {} - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp, class _Alloc> -inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT - : __size_alloc_(0, _VSTD::move(__a)) {} -#endif - -template <class _Tp, class _Alloc> -__list_imp<_Tp, _Alloc>::~__list_imp() { - clear(); -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__erase_c(this); -#endif -} - -template <class _Tp, class _Alloc> -void -__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT -{ - if (!empty()) - { - __node_allocator& __na = __node_alloc(); - __link_pointer __f = __end_.__next_; - __link_pointer __l = __end_as_link(); - __unlink_nodes(__f, __l->__prev_); - __sz() = 0; - while (__f != __l) - { - __node_pointer __np = __f->__as_node(); - __f = __f->__next_; - __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); - __node_alloc_traits::deallocate(__na, __np, 1); - } - __invalidate_all_iterators(); - } -} - -template <class _Tp, class _Alloc> -void -__list_imp<_Tp, _Alloc>::swap(__list_imp& __c) -#if _LIBCPP_STD_VER >= 14 - _NOEXCEPT -#else - _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || - __is_nothrow_swappable<allocator_type>::value) -#endif -{ - _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value || - this->__node_alloc() == __c.__node_alloc(), - "list::swap: Either propagate_on_container_swap must be true" - " or the allocators must compare equal"); - using _VSTD::swap; - _VSTD::__swap_allocator(__node_alloc(), __c.__node_alloc()); - swap(__sz(), __c.__sz()); - swap(__end_, __c.__end_); - if (__sz() == 0) - __end_.__next_ = __end_.__prev_ = __end_as_link(); - else - __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link(); - if (__c.__sz() == 0) - __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link(); - else - __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link(); - -#if _LIBCPP_DEBUG_LEVEL == 2 - __libcpp_db* __db = __get_db(); - __c_node* __cn1 = __db->__find_c_and_lock(this); - __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); - _VSTD::swap(__cn1->beg_, __cn2->beg_); - _VSTD::swap(__cn1->end_, __cn2->end_); - _VSTD::swap(__cn1->cap_, __cn2->cap_); - for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;) - { - --__p; - const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_); - if (__i->__ptr_ == __c.__end_as_link()) - { - __cn2->__add(*__p); - if (--__cn1->end_ != __p) - _VSTD::memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*)); - } - else - (*__p)->__c_ = __cn1; - } - for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) - { - --__p; - const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_); - if (__i->__ptr_ == __end_as_link()) - { - __cn1->__add(*__p); - if (--__cn2->end_ != __p) - _VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); - } - else - (*__p)->__c_ = __cn2; - } - __db->unlock(); -#endif -} - -template <class _Tp, class _Alloc /*= allocator<_Tp>*/> -class _LIBCPP_TEMPLATE_VIS list - : private __list_imp<_Tp, _Alloc> -{ - typedef __list_imp<_Tp, _Alloc> base; - typedef typename base::__node __node; - typedef typename base::__node_allocator __node_allocator; - typedef typename base::__node_pointer __node_pointer; - typedef typename base::__node_alloc_traits __node_alloc_traits; - typedef typename base::__node_base __node_base; - typedef typename base::__node_base_pointer __node_base_pointer; - typedef typename base::__link_pointer __link_pointer; - -public: - typedef _Tp value_type; - typedef _Alloc allocator_type; - static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename base::pointer pointer; - typedef typename base::const_pointer const_pointer; - typedef typename base::size_type size_type; - typedef typename base::difference_type difference_type; - typedef typename base::iterator iterator; - typedef typename base::const_iterator const_iterator; - typedef _VSTD::reverse_iterator<iterator> reverse_iterator; - typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; -#if _LIBCPP_STD_VER > 17 - typedef size_type __remove_return_type; -#else - typedef void __remove_return_type; -#endif - - _LIBCPP_INLINE_VISIBILITY - list() - _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - { - _VSTD::__debug_db_insert_c(this); - } - _LIBCPP_INLINE_VISIBILITY - explicit list(const allocator_type& __a) : base(__a) - { - _VSTD::__debug_db_insert_c(this); - } - explicit list(size_type __n); -#if _LIBCPP_STD_VER > 11 - explicit list(size_type __n, const allocator_type& __a); -#endif - list(size_type __n, const value_type& __x); - template <class = __enable_if_t<__is_allocator<_Alloc>::value> > - list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) - { - _VSTD::__debug_db_insert_c(this); - for (; __n > 0; --__n) - push_back(__x); - } - - template <class _InpIter> - list(_InpIter __f, _InpIter __l, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); - template <class _InpIter> - list(_InpIter __f, _InpIter __l, const allocator_type& __a, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); - - list(const list& __c); - list(const list& __c, const __identity_t<allocator_type>& __a); - _LIBCPP_INLINE_VISIBILITY - list& operator=(const list& __c); -#ifndef _LIBCPP_CXX03_LANG - list(initializer_list<value_type> __il); - list(initializer_list<value_type> __il, const allocator_type& __a); - - _LIBCPP_INLINE_VISIBILITY - list(list&& __c) - _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); - _LIBCPP_INLINE_VISIBILITY - list(list&& __c, const __identity_t<allocator_type>& __a); - _LIBCPP_INLINE_VISIBILITY - list& operator=(list&& __c) - _NOEXCEPT_( - __node_alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<__node_allocator>::value); - - _LIBCPP_INLINE_VISIBILITY - list& operator=(initializer_list<value_type> __il) - {assign(__il.begin(), __il.end()); return *this;} - - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list<value_type> __il) - {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - - template <class _InpIter> - void assign(_InpIter __f, _InpIter __l, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); - void assign(size_type __n, const value_type& __x); - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return base::__sz();} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return base::empty();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT - { - return _VSTD::min<size_type>( - base::__node_alloc_max_size(), - numeric_limits<difference_type >::max()); - } - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return base::begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return base::begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return base::end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return base::end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return base::begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return base::end();} - - _LIBCPP_INLINE_VISIBILITY - reverse_iterator rbegin() _NOEXCEPT - {return reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rbegin() const _NOEXCEPT - {return const_reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - reverse_iterator rend() _NOEXCEPT - {return reverse_iterator(begin());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rend() const _NOEXCEPT - {return const_reverse_iterator(begin());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crbegin() const _NOEXCEPT - {return const_reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crend() const _NOEXCEPT - {return const_reverse_iterator(begin());} - - _LIBCPP_INLINE_VISIBILITY - reference front() - { - _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); - return base::__end_.__next_->__as_node()->__value_; - } - _LIBCPP_INLINE_VISIBILITY - const_reference front() const - { - _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); - return base::__end_.__next_->__as_node()->__value_; - } - _LIBCPP_INLINE_VISIBILITY - reference back() - { - _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); - return base::__end_.__prev_->__as_node()->__value_; - } - _LIBCPP_INLINE_VISIBILITY - const_reference back() const - { - _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); - return base::__end_.__prev_->__as_node()->__value_; - } - -#ifndef _LIBCPP_CXX03_LANG - void push_front(value_type&& __x); - void push_back(value_type&& __x); - - template <class... _Args> -#if _LIBCPP_STD_VER > 14 - reference emplace_front(_Args&&... __args); -#else - void emplace_front(_Args&&... __args); -#endif - template <class... _Args> -#if _LIBCPP_STD_VER > 14 - reference emplace_back(_Args&&... __args); -#else - void emplace_back(_Args&&... __args); -#endif - template <class... _Args> - iterator emplace(const_iterator __p, _Args&&... __args); - - iterator insert(const_iterator __p, value_type&& __x); - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, initializer_list<value_type> __il) - {return insert(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - - void push_front(const value_type& __x); - void push_back(const value_type& __x); - -#ifndef _LIBCPP_CXX03_LANG - template <class _Arg> - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); } -#else - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(value_type const& __arg) { push_back(__arg); } -#endif - - iterator insert(const_iterator __p, const value_type& __x); - iterator insert(const_iterator __p, size_type __n, const value_type& __x); - template <class _InpIter> - iterator insert(const_iterator __p, _InpIter __f, _InpIter __l, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); - - _LIBCPP_INLINE_VISIBILITY - void swap(list& __c) -#if _LIBCPP_STD_VER >= 14 - _NOEXCEPT -#else - _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value || - __is_nothrow_swappable<__node_allocator>::value) -#endif - {base::swap(__c);} - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {base::clear();} - - void pop_front(); - void pop_back(); - - iterator erase(const_iterator __p); - iterator erase(const_iterator __f, const_iterator __l); - - void resize(size_type __n); - void resize(size_type __n, const value_type& __x); - - void splice(const_iterator __p, list& __c); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void splice(const_iterator __p, list&& __c) {splice(__p, __c);} - _LIBCPP_INLINE_VISIBILITY - void splice(const_iterator __p, list&& __c, const_iterator __i) - {splice(__p, __c, __i);} - _LIBCPP_INLINE_VISIBILITY - void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) - {splice(__p, __c, __f, __l);} -#endif - void splice(const_iterator __p, list& __c, const_iterator __i); - void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); - - __remove_return_type remove(const value_type& __x); - template <class _Pred> __remove_return_type remove_if(_Pred __pred); - _LIBCPP_INLINE_VISIBILITY - __remove_return_type unique() { return unique(__equal_to<value_type>()); } - template <class _BinaryPred> - __remove_return_type unique(_BinaryPred __binary_pred); - _LIBCPP_INLINE_VISIBILITY - void merge(list& __c); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void merge(list&& __c) {merge(__c);} - - template <class _Comp> - _LIBCPP_INLINE_VISIBILITY - void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} -#endif - template <class _Comp> - void merge(list& __c, _Comp __comp); - - _LIBCPP_INLINE_VISIBILITY - void sort(); - template <class _Comp> - _LIBCPP_INLINE_VISIBILITY - void sort(_Comp __comp); - - void reverse() _NOEXCEPT; - - bool __invariants() const; - - typedef __allocator_destructor<__node_allocator> __node_destructor; - typedef unique_ptr<__node, __node_destructor> __hold_pointer; - - _LIBCPP_INLINE_VISIBILITY - __hold_pointer __allocate_node(__node_allocator& __na) { - __node_pointer __p = __node_alloc_traits::allocate(__na, 1); - __p->__prev_ = nullptr; - return __hold_pointer(__p, __node_destructor(__na, 1)); - } - -#if _LIBCPP_DEBUG_LEVEL == 2 - - 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 - -private: - _LIBCPP_INLINE_VISIBILITY - static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l); - _LIBCPP_INLINE_VISIBILITY - void __link_nodes_at_front(__link_pointer __f, __link_pointer __l); - _LIBCPP_INLINE_VISIBILITY - void __link_nodes_at_back (__link_pointer __f, __link_pointer __l); - iterator __iterator(size_type __n); - template <class _Comp> - static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp); - - void __move_assign(list& __c, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value); - void __move_assign(list& __c, false_type); -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Alloc = allocator<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Alloc>::value> - > -list(_InputIterator, _InputIterator) - -> list<__iter_value_type<_InputIterator>, _Alloc>; - -template<class _InputIterator, - class _Alloc, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Alloc>::value> - > -list(_InputIterator, _InputIterator, _Alloc) - -> list<__iter_value_type<_InputIterator>, _Alloc>; -#endif - -// Link in nodes [__f, __l] just prior to __p -template <class _Tp, class _Alloc> -inline -void -list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) -{ - __p->__prev_->__next_ = __f; - __f->__prev_ = __p->__prev_; - __p->__prev_ = __l; - __l->__next_ = __p; -} - -// Link in nodes [__f, __l] at the front of the list -template <class _Tp, class _Alloc> -inline -void -list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) -{ - __f->__prev_ = base::__end_as_link(); - __l->__next_ = base::__end_.__next_; - __l->__next_->__prev_ = __l; - base::__end_.__next_ = __f; -} - -// Link in nodes [__f, __l] at the back of the list -template <class _Tp, class _Alloc> -inline -void -list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) -{ - __l->__next_ = base::__end_as_link(); - __f->__prev_ = base::__end_.__prev_; - __f->__prev_->__next_ = __f; - base::__end_.__prev_ = __l; -} - - -template <class _Tp, class _Alloc> -inline -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::__iterator(size_type __n) -{ - return __n <= base::__sz() / 2 ? _VSTD::next(begin(), __n) - : _VSTD::prev(end(), base::__sz() - __n); -} - -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(size_type __n) -{ - _VSTD::__debug_db_insert_c(this); - for (; __n > 0; --__n) -#ifndef _LIBCPP_CXX03_LANG - emplace_back(); -#else - push_back(value_type()); -#endif -} - -#if _LIBCPP_STD_VER > 11 -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) -{ - _VSTD::__debug_db_insert_c(this); - for (; __n > 0; --__n) - emplace_back(); -} -#endif - -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) -{ - _VSTD::__debug_db_insert_c(this); - for (; __n > 0; --__n) - push_back(__x); -} - -template <class _Tp, class _Alloc> -template <class _InpIter> -list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) -{ - _VSTD::__debug_db_insert_c(this); - for (; __f != __l; ++__f) - __emplace_back(*__f); -} - -template <class _Tp, class _Alloc> -template <class _InpIter> -list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) - : base(__a) -{ - _VSTD::__debug_db_insert_c(this); - for (; __f != __l; ++__f) - __emplace_back(*__f); -} - -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(const list& __c) - : base(__node_alloc_traits::select_on_container_copy_construction( - __c.__node_alloc())) { - _VSTD::__debug_db_insert_c(this); - for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) - push_back(*__i); -} - -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(const list& __c, const __identity_t<allocator_type>& __a) - : base(__a) -{ - _VSTD::__debug_db_insert_c(this); - for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) - push_back(*__i); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a) - : base(__a) -{ - _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); -} - -template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(initializer_list<value_type> __il) -{ - _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); -} - -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())) { - _VSTD::__debug_db_insert_c(this); - splice(end(), __c); -} - -template <class _Tp, class _Alloc> -inline -list<_Tp, _Alloc>::list(list&& __c, const __identity_t<allocator_type>& __a) - : base(__a) -{ - _VSTD::__debug_db_insert_c(this); - if (__a == __c.get_allocator()) - splice(end(), __c); - else - { - typedef move_iterator<iterator> _Ip; - assign(_Ip(__c.begin()), _Ip(__c.end())); - } -} - -template <class _Tp, class _Alloc> -inline -list<_Tp, _Alloc>& -list<_Tp, _Alloc>::operator=(list&& __c) - _NOEXCEPT_( - __node_alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<__node_allocator>::value) -{ - __move_assign(__c, integral_constant<bool, - __node_alloc_traits::propagate_on_container_move_assignment::value>()); - return *this; -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::__move_assign(list& __c, false_type) -{ - if (base::__node_alloc() != __c.__node_alloc()) - { - typedef move_iterator<iterator> _Ip; - assign(_Ip(__c.begin()), _Ip(__c.end())); - } - else - __move_assign(__c, true_type()); -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::__move_assign(list& __c, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) -{ - clear(); - base::__move_assign_alloc(__c); - splice(end(), __c); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -inline -list<_Tp, _Alloc>& -list<_Tp, _Alloc>::operator=(const list& __c) -{ - if (this != _VSTD::addressof(__c)) - { - base::__copy_assign_alloc(__c); - assign(__c.begin(), __c.end()); - } - return *this; -} - -template <class _Tp, class _Alloc> -template <class _InpIter> -void -list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) -{ - iterator __i = begin(); - iterator __e = end(); - for (; __f != __l && __i != __e; ++__f, (void) ++__i) - *__i = *__f; - if (__i == __e) - insert(__e, __f, __l); - else - erase(__i, __e); -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__invalidate_all(this); -#endif -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x) -{ - iterator __i = begin(); - iterator __e = end(); - for (; __n > 0 && __i != __e; --__n, (void) ++__i) - *__i = __x; - if (__i == __e) - insert(__e, __n, __x); - else - erase(__i, __e); -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__invalidate_all(this); -#endif -} - -template <class _Tp, class _Alloc> -inline -_Alloc -list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT -{ - return allocator_type(base::__node_alloc()); -} - -template <class _Tp, class _Alloc> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::insert(iterator, x) called with an iterator not referring to this list"); - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); - ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__hold.release()->__as_link(), this); -#else - return iterator(__hold.release()->__as_link()); -#endif -} - -template <class _Tp, class _Alloc> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::insert(iterator, n, x) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); -#endif - if (__n > 0) - { - size_type __ds = 0; - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 - __r = iterator(__hold->__as_link(), this); -#else - __r = iterator(__hold->__as_link()); -#endif - __hold.release(); - iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { -#endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) - { - __hold.reset(__node_alloc_traits::allocate(__na, 1)); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __e.__ptr_->__next_ = __hold->__as_link(); - __hold->__prev_ = __e.__ptr_; - __hold.release(); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - while (true) - { - __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e)); - __link_pointer __prev = __e.__ptr_->__prev_; - __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); - if (__prev == 0) - break; -#if _LIBCPP_DEBUG_LEVEL == 2 - __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif - } - throw; - } -#endif // _LIBCPP_NO_EXCEPTIONS - __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); - base::__sz() += __ds; - } - return __r; -} - -template <class _Tp, class _Alloc> -template <class _InpIter> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, - typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::insert(iterator, range) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); -#endif - if (__f != __l) - { - size_type __ds = 0; - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); - ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 - __r = iterator(__hold.get()->__as_link(), this); -#else - __r = iterator(__hold.get()->__as_link()); -#endif - __hold.release(); - iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { -#endif // _LIBCPP_NO_EXCEPTIONS - for (++__f; __f != __l; ++__f, (void) ++__e, ++__ds) - { - __hold.reset(__node_alloc_traits::allocate(__na, 1)); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); - __e.__ptr_->__next_ = __hold.get()->__as_link(); - __hold->__prev_ = __e.__ptr_; - __hold.release(); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - while (true) - { - __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e)); - __link_pointer __prev = __e.__ptr_->__prev_; - __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); - if (__prev == 0) - break; -#if _LIBCPP_DEBUG_LEVEL == 2 - __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif - } - throw; - } -#endif // _LIBCPP_NO_EXCEPTIONS - __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); - base::__sz() += __ds; - } - return __r; -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::push_front(const value_type& __x) -{ - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_pointer __nl = __hold->__as_link(); - __link_nodes_at_front(__nl, __nl); - ++base::__sz(); - __hold.release(); -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::push_back(const value_type& __x) -{ - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); - ++base::__sz(); - __hold.release(); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::push_front(value_type&& __x) -{ - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); - ++base::__sz(); - __hold.release(); -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::push_back(value_type&& __x) -{ - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); - ++base::__sz(); - __hold.release(); -} - -template <class _Tp, class _Alloc> -template <class... _Args> -#if _LIBCPP_STD_VER > 14 -typename list<_Tp, _Alloc>::reference -#else -void -#endif -list<_Tp, _Alloc>::emplace_front(_Args&&... __args) -{ - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); - ++base::__sz(); -#if _LIBCPP_STD_VER > 14 - return __hold.release()->__value_; -#else - __hold.release(); -#endif -} - -template <class _Tp, class _Alloc> -template <class... _Args> -#if _LIBCPP_STD_VER > 14 -typename list<_Tp, _Alloc>::reference -#else -void -#endif -list<_Tp, _Alloc>::emplace_back(_Args&&... __args) -{ - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_pointer __nl = __hold->__as_link(); - __link_nodes_at_back(__nl, __nl); - ++base::__sz(); -#if _LIBCPP_STD_VER > 14 - return __hold.release()->__value_; -#else - __hold.release(); -#endif -} - -template <class _Tp, class _Alloc> -template <class... _Args> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::emplace(iterator, args...) called with an iterator not referring to this list"); - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_pointer __nl = __hold.get()->__as_link(); - __link_nodes(__p.__ptr_, __nl, __nl); - ++base::__sz(); - __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__nl, this); -#else - return iterator(__nl); -#endif -} - -template <class _Tp, class _Alloc> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::insert(iterator, x) called with an iterator not referring to this list"); - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_pointer __nl = __hold->__as_link(); - __link_nodes(__p.__ptr_, __nl, __nl); - ++base::__sz(); - __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__nl, this); -#else - return iterator(__nl); -#endif -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::pop_front() -{ - _LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list"); - __node_allocator& __na = base::__node_alloc(); - __link_pointer __n = base::__end_.__next_; - base::__unlink_nodes(__n, __n); - --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 - __c_node* __c = __get_db()->__find_c_and_lock(this); - for (__i_node** __p = __c->end_; __p != __c->beg_; ) - { - --__p; - iterator* __i = static_cast<iterator*>((*__p)->__i_); - if (__i->__ptr_ == __n) - { - (*__p)->__c_ = nullptr; - if (--__c->end_ != __p) - _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); - } - } - __get_db()->unlock(); -#endif - __node_pointer __np = __n->__as_node(); - __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); - __node_alloc_traits::deallocate(__na, __np, 1); -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::pop_back() -{ - _LIBCPP_ASSERT(!empty(), "list::pop_back() called on an empty list"); - __node_allocator& __na = base::__node_alloc(); - __link_pointer __n = base::__end_.__prev_; - base::__unlink_nodes(__n, __n); - --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 - __c_node* __c = __get_db()->__find_c_and_lock(this); - for (__i_node** __p = __c->end_; __p != __c->beg_; ) - { - --__p; - iterator* __i = static_cast<iterator*>((*__p)->__i_); - if (__i->__ptr_ == __n) - { - (*__p)->__c_ = nullptr; - if (--__c->end_ != __p) - _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); - } - } - __get_db()->unlock(); -#endif - __node_pointer __np = __n->__as_node(); - __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); - __node_alloc_traits::deallocate(__na, __np, 1); -} - -template <class _Tp, class _Alloc> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::erase(const_iterator __p) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::erase(iterator) called with an iterator not referring to this list"); - _LIBCPP_ASSERT(__p != end(), - "list::erase(iterator) called with a non-dereferenceable iterator"); - __node_allocator& __na = base::__node_alloc(); - __link_pointer __n = __p.__ptr_; - __link_pointer __r = __n->__next_; - base::__unlink_nodes(__n, __n); - --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 - __c_node* __c = __get_db()->__find_c_and_lock(this); - for (__i_node** __ip = __c->end_; __ip != __c->beg_; ) - { - --__ip; - iterator* __i = static_cast<iterator*>((*__ip)->__i_); - if (__i->__ptr_ == __n) - { - (*__ip)->__c_ = nullptr; - if (--__c->end_ != __ip) - _VSTD::memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*)); - } - } - __get_db()->unlock(); -#endif - __node_pointer __np = __n->__as_node(); - __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); - __node_alloc_traits::deallocate(__na, __np, 1); -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__r, this); -#else - return iterator(__r); -#endif -} - -template <class _Tp, class _Alloc> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__f)) == this, - "list::erase(iterator, iterator) called with an iterator not referring to this list"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == this, - "list::erase(iterator, iterator) called with an iterator not referring to this list"); - if (__f != __l) - { - __node_allocator& __na = base::__node_alloc(); - base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_); - while (__f != __l) - { - __link_pointer __n = __f.__ptr_; - ++__f; - --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 - __c_node* __c = __get_db()->__find_c_and_lock(this); - for (__i_node** __p = __c->end_; __p != __c->beg_; ) - { - --__p; - iterator* __i = static_cast<iterator*>((*__p)->__i_); - if (__i->__ptr_ == __n) - { - (*__p)->__c_ = nullptr; - if (--__c->end_ != __p) - _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); - } - } - __get_db()->unlock(); -#endif - __node_pointer __np = __n->__as_node(); - __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); - __node_alloc_traits::deallocate(__na, __np, 1); - } - } -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(__l.__ptr_, this); -#else - return iterator(__l.__ptr_); -#endif -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::resize(size_type __n) -{ - if (__n < base::__sz()) - erase(__iterator(__n), end()); - else if (__n > base::__sz()) - { - __n -= base::__sz(); - size_type __ds = 0; - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); - ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator __r = iterator(__hold.release()->__as_link(), this); -#else - iterator __r = iterator(__hold.release()->__as_link()); -#endif - iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { -#endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) - { - __hold.reset(__node_alloc_traits::allocate(__na, 1)); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); - __e.__ptr_->__next_ = __hold.get()->__as_link(); - __hold->__prev_ = __e.__ptr_; - __hold.release(); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - while (true) - { - __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e)); - __link_pointer __prev = __e.__ptr_->__prev_; - __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); - if (__prev == 0) - break; -#if _LIBCPP_DEBUG_LEVEL == 2 - __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif - } - throw; - } -#endif // _LIBCPP_NO_EXCEPTIONS - __link_nodes_at_back(__r.__ptr_, __e.__ptr_); - base::__sz() += __ds; - } -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) -{ - if (__n < base::__sz()) - erase(__iterator(__n), end()); - else if (__n > base::__sz()) - { - __n -= base::__sz(); - size_type __ds = 0; - __node_allocator& __na = base::__node_alloc(); - __hold_pointer __hold = __allocate_node(__na); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - ++__ds; - __link_pointer __nl = __hold.release()->__as_link(); -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator __r = iterator(__nl, this); -#else - iterator __r = iterator(__nl); -#endif - iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { -#endif // _LIBCPP_NO_EXCEPTIONS - for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) - { - __hold.reset(__node_alloc_traits::allocate(__na, 1)); - __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __e.__ptr_->__next_ = __hold.get()->__as_link(); - __hold->__prev_ = __e.__ptr_; - __hold.release(); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - while (true) - { - __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e)); - __link_pointer __prev = __e.__ptr_->__prev_; - __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); - if (__prev == 0) - break; -#if _LIBCPP_DEBUG_LEVEL == 2 - __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif - } - throw; - } -#endif // _LIBCPP_NO_EXCEPTIONS - __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_); - base::__sz() += __ds; - } -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) -{ - _LIBCPP_ASSERT(this != _VSTD::addressof(__c), - "list::splice(iterator, list) called with this == &list"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::splice(iterator, list) called with an iterator not referring to this list"); - if (!__c.empty()) - { - __link_pointer __f = __c.__end_.__next_; - __link_pointer __l = __c.__end_.__prev_; - base::__unlink_nodes(__f, __l); - __link_nodes(__p.__ptr_, __f, __l); - base::__sz() += __c.__sz(); - __c.__sz() = 0; -#if _LIBCPP_DEBUG_LEVEL == 2 - if (_VSTD::addressof(__c) != this) { - __libcpp_db* __db = __get_db(); - __c_node* __cn1 = __db->__find_c_and_lock(this); - __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); - for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;) - { - --__ip; - iterator* __i = static_cast<iterator*>((*__ip)->__i_); - if (__i->__ptr_ != __c.__end_as_link()) - { - __cn1->__add(*__ip); - (*__ip)->__c_ = __cn1; - if (--__cn2->end_ != __ip) - memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); - } - } - __db->unlock(); - } -#endif - } -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::splice(iterator, list, iterator) called with the first iterator not referring to this list"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__i)) == _VSTD::addressof(__c), - "list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(_VSTD::addressof(__i)), - "list::splice(iterator, list, iterator) called with the second iterator not dereferenceable"); - - if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) - { - __link_pointer __f = __i.__ptr_; - base::__unlink_nodes(__f, __f); - __link_nodes(__p.__ptr_, __f, __f); - --__c.__sz(); - ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (_VSTD::addressof(__c) != this) { - __libcpp_db* __db = __get_db(); - __c_node* __cn1 = __db->__find_c_and_lock(this); - __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); - for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;) - { - --__ip; - iterator* __j = static_cast<iterator*>((*__ip)->__i_); - if (__j->__ptr_ == __f) - { - __cn1->__add(*__ip); - (*__ip)->__c_ = __cn1; - if (--__cn2->end_ != __ip) - _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); - } - } - __db->unlock(); - } -#endif - } -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) -{ - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "list::splice(iterator, list, iterator, iterator) called with first iterator not referring to this list"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__f)) == _VSTD::addressof(__c), - "list::splice(iterator, list, iterator, iterator) called with second iterator not referring to the list argument"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == _VSTD::addressof(__c), - "list::splice(iterator, list, iterator, iterator) called with third iterator not referring to the list argument"); - -#if _LIBCPP_DEBUG_LEVEL == 2 - if (this == _VSTD::addressof(__c)) - { - for (const_iterator __i = __f; __i != __l; ++__i) - _LIBCPP_DEBUG_ASSERT(__i != __p, - "list::splice(iterator, list, iterator, iterator)" - " called with the first iterator within the range of the second and third iterators"); - } -#endif - if (__f != __l) - { - __link_pointer __first = __f.__ptr_; - --__l; - __link_pointer __last = __l.__ptr_; - if (this != _VSTD::addressof(__c)) - { - size_type __s = _VSTD::distance(__f, __l) + 1; - __c.__sz() -= __s; - base::__sz() += __s; - } - base::__unlink_nodes(__first, __last); - __link_nodes(__p.__ptr_, __first, __last); -#if _LIBCPP_DEBUG_LEVEL == 2 - if (_VSTD::addressof(__c) != this) { - __libcpp_db* __db = __get_db(); - __c_node* __cn1 = __db->__find_c_and_lock(this); - __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); - for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;) - { - --__ip; - iterator* __j = static_cast<iterator*>((*__ip)->__i_); - for (__link_pointer __k = __f.__ptr_; - __k != __l.__ptr_; __k = __k->__next_) - { - if (__j->__ptr_ == __k) - { - __cn1->__add(*__ip); - (*__ip)->__c_ = __cn1; - if (--__cn2->end_ != __ip) - _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); - } - } - } - __db->unlock(); - } -#endif - } -} - -template <class _Tp, class _Alloc> -typename list<_Tp, _Alloc>::__remove_return_type -list<_Tp, _Alloc>::remove(const value_type& __x) -{ - list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing - for (const_iterator __i = begin(), __e = end(); __i != __e;) - { - if (*__i == __x) - { - const_iterator __j = _VSTD::next(__i); - for (; __j != __e && *__j == __x; ++__j) - ; - __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); - __i = __j; - if (__i != __e) - ++__i; - } - else - ++__i; - } - - return (__remove_return_type) __deleted_nodes.size(); -} - -template <class _Tp, class _Alloc> -template <class _Pred> -typename list<_Tp, _Alloc>::__remove_return_type -list<_Tp, _Alloc>::remove_if(_Pred __pred) -{ - list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing - for (iterator __i = begin(), __e = end(); __i != __e;) - { - if (__pred(*__i)) - { - iterator __j = _VSTD::next(__i); - for (; __j != __e && __pred(*__j); ++__j) - ; - __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); - __i = __j; - if (__i != __e) - ++__i; - } - else - ++__i; - } - - return (__remove_return_type) __deleted_nodes.size(); -} - -template <class _Tp, class _Alloc> -template <class _BinaryPred> -typename list<_Tp, _Alloc>::__remove_return_type -list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred) -{ - list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing - for (iterator __i = begin(), __e = end(); __i != __e;) - { - iterator __j = _VSTD::next(__i); - for (; __j != __e && __binary_pred(*__i, *__j); ++__j) - ; - if (++__i != __j) { - __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); - __i = __j; - } - } - - return (__remove_return_type) __deleted_nodes.size(); -} - -template <class _Tp, class _Alloc> -inline -void -list<_Tp, _Alloc>::merge(list& __c) -{ - merge(__c, __less<value_type>()); -} - -template <class _Tp, class _Alloc> -template <class _Comp> -void -list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) -{ - if (this != _VSTD::addressof(__c)) - { - iterator __f1 = begin(); - iterator __e1 = end(); - iterator __f2 = __c.begin(); - iterator __e2 = __c.end(); - while (__f1 != __e1 && __f2 != __e2) - { - if (__comp(*__f2, *__f1)) - { - size_type __ds = 1; - iterator __m2 = _VSTD::next(__f2); - for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void) ++__ds) - ; - base::__sz() += __ds; - __c.__sz() -= __ds; - __link_pointer __f = __f2.__ptr_; - __link_pointer __l = __m2.__ptr_->__prev_; - __f2 = __m2; - base::__unlink_nodes(__f, __l); - __m2 = _VSTD::next(__f1); - __link_nodes(__f1.__ptr_, __f, __l); - __f1 = __m2; - } - else - ++__f1; - } - splice(__e1, __c); -#if _LIBCPP_DEBUG_LEVEL == 2 - __libcpp_db* __db = __get_db(); - __c_node* __cn1 = __db->__find_c_and_lock(this); - __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); - for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) - { - --__p; - iterator* __i = static_cast<iterator*>((*__p)->__i_); - if (__i->__ptr_ != __c.__end_as_link()) - { - __cn1->__add(*__p); - (*__p)->__c_ = __cn1; - if (--__cn2->end_ != __p) - _VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); - } - } - __db->unlock(); -#endif - } -} - -template <class _Tp, class _Alloc> -inline -void -list<_Tp, _Alloc>::sort() -{ - sort(__less<value_type>()); -} - -template <class _Tp, class _Alloc> -template <class _Comp> -inline -void -list<_Tp, _Alloc>::sort(_Comp __comp) -{ - __sort(begin(), end(), base::__sz(), __comp); -} - -template <class _Tp, class _Alloc> -template <class _Comp> -typename list<_Tp, _Alloc>::iterator -list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp) -{ - switch (__n) - { - case 0: - case 1: - return __f1; - case 2: - if (__comp(*--__e2, *__f1)) - { - __link_pointer __f = __e2.__ptr_; - base::__unlink_nodes(__f, __f); - __link_nodes(__f1.__ptr_, __f, __f); - return __e2; - } - return __f1; - } - size_type __n2 = __n / 2; - iterator __e1 = _VSTD::next(__f1, __n2); - iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp); - iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp); - if (__comp(*__f2, *__f1)) - { - iterator __m2 = _VSTD::next(__f2); - for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) - ; - __link_pointer __f = __f2.__ptr_; - __link_pointer __l = __m2.__ptr_->__prev_; - __r = __f2; - __e1 = __f2 = __m2; - base::__unlink_nodes(__f, __l); - __m2 = _VSTD::next(__f1); - __link_nodes(__f1.__ptr_, __f, __l); - __f1 = __m2; - } - else - ++__f1; - while (__f1 != __e1 && __f2 != __e2) - { - if (__comp(*__f2, *__f1)) - { - iterator __m2 = _VSTD::next(__f2); - for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) - ; - __link_pointer __f = __f2.__ptr_; - __link_pointer __l = __m2.__ptr_->__prev_; - if (__e1 == __f2) - __e1 = __m2; - __f2 = __m2; - base::__unlink_nodes(__f, __l); - __m2 = _VSTD::next(__f1); - __link_nodes(__f1.__ptr_, __f, __l); - __f1 = __m2; - } - else - ++__f1; - } - return __r; -} - -template <class _Tp, class _Alloc> -void -list<_Tp, _Alloc>::reverse() _NOEXCEPT -{ - if (base::__sz() > 1) - { - iterator __e = end(); - for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;) - { - _VSTD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_); - __i.__ptr_ = __i.__ptr_->__prev_; - } - _VSTD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_); - } -} - -template <class _Tp, class _Alloc> -bool -list<_Tp, _Alloc>::__invariants() const -{ - return size() == _VSTD::distance(begin(), end()); -} - -#if _LIBCPP_DEBUG_LEVEL == 2 - -template <class _Tp, class _Alloc> -bool -list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const -{ - return __i->__ptr_ != this->__end_as_link(); -} - -template <class _Tp, class _Alloc> -bool -list<_Tp, _Alloc>::__decrementable(const const_iterator* __i) const -{ - return !empty() && __i->__ptr_ != base::__end_.__next_; -} - -template <class _Tp, class _Alloc> -bool -list<_Tp, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const -{ - return false; -} - -template <class _Tp, class _Alloc> -bool -list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const -{ - return false; -} - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) -{ - return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) -{ - return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) -{ - return !(__x == __y); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) -{ - return __y < __x; -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) -{ - return !(__x < __y); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) -{ - return !(__y < __x); -} - -template <class _Tp, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Tp, class _Allocator, class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY typename list<_Tp, _Allocator>::size_type -erase_if(list<_Tp, _Allocator>& __c, _Predicate __pred) { - return __c.remove_if(__pred); -} - -template <class _Tp, class _Allocator, class _Up> -inline _LIBCPP_INLINE_VISIBILITY typename list<_Tp, _Allocator>::size_type -erase(list<_Tp, _Allocator>& __c, const _Up& __v) { - return _VSTD::erase_if(__c, [&](auto& __elem) { return __elem == __v; }); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_LIST diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/numbers b/contrib/libs/cxxsupp/libcxxmsvc/include/numbers deleted file mode 100644 index 9a52d142c4..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/numbers +++ /dev/null @@ -1,133 +0,0 @@ -// -*- 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_NUMBERS -#define _LIBCPP_NUMBERS - -/* - numbers synopsis - -namespace std::numbers { - template<class T> inline constexpr T e_v = unspecified; - template<class T> inline constexpr T log2e_v = unspecified; - template<class T> inline constexpr T log10e_v = unspecified; - template<class T> inline constexpr T pi_v = unspecified; - template<class T> inline constexpr T inv_pi_v = unspecified; - template<class T> inline constexpr T inv_sqrtpi_v = unspecified; - template<class T> inline constexpr T ln2_v = unspecified; - template<class T> inline constexpr T ln10_v = unspecified; - template<class T> inline constexpr T sqrt2_v = unspecified; - template<class T> inline constexpr T sqrt3_v = unspecified; - template<class T> inline constexpr T inv_sqrt3_v = unspecified; - template<class T> inline constexpr T egamma_v = unspecified; - template<class T> inline constexpr T phi_v = unspecified; - - template<floating_point T> inline constexpr T e_v<T> = see below; - template<floating_point T> inline constexpr T log2e_v<T> = see below; - template<floating_point T> inline constexpr T log10e_v<T> = see below; - template<floating_point T> inline constexpr T pi_v<T> = see below; - template<floating_point T> inline constexpr T inv_pi_v<T> = see below; - template<floating_point T> inline constexpr T inv_sqrtpi_v<T> = see below; - template<floating_point T> inline constexpr T ln2_v<T> = see below; - template<floating_point T> inline constexpr T ln10_v<T> = see below; - template<floating_point T> inline constexpr T sqrt2_v<T> = see below; - template<floating_point T> inline constexpr T sqrt3_v<T> = see below; - template<floating_point T> inline constexpr T inv_sqrt3_v<T> = see below; - template<floating_point T> inline constexpr T egamma_v<T> = see below; - template<floating_point T> inline constexpr T phi_v<T> = see below; - - inline constexpr double e = e_v<double>; - inline constexpr double log2e = log2e_v<double>; - inline constexpr double log10e = log10e_v<double>; - inline constexpr double pi = pi_v<double>; - inline constexpr double inv_pi = inv_pi_v<double>; - inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>; - inline constexpr double ln2 = ln2_v<double>; - inline constexpr double ln10 = ln10_v<double>; - inline constexpr double sqrt2 = sqrt2_v<double>; - inline constexpr double sqrt3 = sqrt3_v<double>; - inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>; - inline constexpr double egamma = egamma_v<double>; - inline constexpr double phi = phi_v<double>; -} -*/ - -#include <__config> -#include <concepts> -#include <type_traits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace numbers { - -template <class _Tp> -inline constexpr bool __false = false; - -template <class _Tp> -struct __illformed -{ - static_assert(__false<_Tp>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed."); -}; - -template <class _Tp> inline constexpr _Tp e_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp log2e_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp log10e_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp pi_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp inv_pi_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp ln2_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp ln10_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp sqrt2_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp sqrt3_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp egamma_v = __illformed<_Tp>{}; -template <class _Tp> inline constexpr _Tp phi_v = __illformed<_Tp>{}; - -template <floating_point _Tp> inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662L; -template <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892L; -template <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605L; -template <floating_point _Tp> inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502L; -template <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028L; -template <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772L; -template <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176L; -template <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364L; -template <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698L; -template <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872L; -template <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957L; -template <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402L; -template <floating_point _Tp> inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638L; - -inline constexpr double e = e_v<double>; -inline constexpr double log2e = log2e_v<double>; -inline constexpr double log10e = log10e_v<double>; -inline constexpr double pi = pi_v<double>; -inline constexpr double inv_pi = inv_pi_v<double>; -inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>; -inline constexpr double ln2 = ln2_v<double>; -inline constexpr double ln10 = ln10_v<double>; -inline constexpr double sqrt2 = sqrt2_v<double>; -inline constexpr double sqrt3 = sqrt3_v<double>; -inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>; -inline constexpr double egamma = egamma_v<double>; -inline constexpr double phi = phi_v<double>; - -} // namespace numbers - -_LIBCPP_END_NAMESPACE_STD - -#endif //!defined(_LIBCPP_HAS_NO_CONCEPTS) - -#endif // _LIBCPP_NUMBERS diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/queue b/contrib/libs/cxxsupp/libcxxmsvc/include/queue deleted file mode 100644 index b8b7ec46d9..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/queue +++ /dev/null @@ -1,955 +0,0 @@ -// -*- 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_QUEUE -#define _LIBCPP_QUEUE - -/* - queue synopsis - -namespace std -{ - -template <class T, class Container = deque<T>> -class queue -{ -public: - typedef Container container_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::const_reference const_reference; - typedef typename container_type::size_type size_type; - -protected: - container_type c; - -public: - queue() = default; - ~queue() = default; - - queue(const queue& q) = default; - queue(queue&& q) = default; - - queue& operator=(const queue& q) = default; - queue& operator=(queue&& q) = default; - - explicit queue(const container_type& c); - explicit queue(container_type&& c) - template<class InputIterator> - queue(InputIterator first, InputIterator last); // since C++23 - template <class Alloc> - explicit queue(const Alloc& a); - template <class Alloc> - queue(const container_type& c, const Alloc& a); - template <class Alloc> - queue(container_type&& c, const Alloc& a); - template <class Alloc> - queue(const queue& q, const Alloc& a); - template <class Alloc> - queue(queue&& q, const Alloc& a); - template <class InputIterator, class Alloc> - queue(InputIterator first, InputIterator last, const Alloc&); // since C++23 - - bool empty() const; - size_type size() const; - - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; - - void push(const value_type& v); - void push(value_type&& v); - template <class... Args> reference emplace(Args&&... args); // reference in C++17 - void pop(); - - void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>) -}; - -template<class Container> - queue(Container) -> queue<typename Container::value_type, Container>; // C++17 - -template<class InputIterator> - queue(InputIterator, InputIterator) -> queue<iter-value-type<InputIterator>>; // since C++23 - -template<class Container, class Allocator> - queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17 - -template<class InputIterator, class Allocator> - queue(InputIterator, InputIterator, Allocator) - -> queue<iter-value-type<InputIterator>, - deque<iter-value-type<InputIterator>, Allocator>>; // since C++23 - -template <class T, class Container> - bool operator==(const queue<T, Container>& x,const queue<T, Container>& y); - -template <class T, class Container> - bool operator< (const queue<T, Container>& x,const queue<T, Container>& y); - -template <class T, class Container> - bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y); - -template <class T, class Container> - bool operator> (const queue<T, Container>& x,const queue<T, Container>& y); - -template <class T, class Container> - bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y); - -template <class T, class Container> - bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y); - -template <class T, class Container> - void swap(queue<T, Container>& x, queue<T, Container>& y) - noexcept(noexcept(x.swap(y))); - -template <class T, class Container = vector<T>, - class Compare = less<typename Container::value_type>> -class priority_queue -{ -public: - typedef Container container_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::const_reference const_reference; - typedef typename container_type::size_type size_type; - -protected: - container_type c; - Compare comp; - -public: - priority_queue() : priority_queue(Compare()) {} // C++20 - explicit priority_queue(const Compare& x) : priority_queue(x, Container()) {} - priority_queue(const Compare& x, const Container&); - explicit priority_queue(const Compare& x = Compare(), Container&& = Container()); // before C++20 - priority_queue(const Compare& x, Container&&); // C++20 - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& comp = Compare()); - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& comp, const Container& c); - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& comp, Container&& c); - template <class Alloc> - explicit priority_queue(const Alloc& a); - template <class Alloc> - priority_queue(const Compare& comp, const Alloc& a); - template <class Alloc> - priority_queue(const Compare& comp, const Container& c, - const Alloc& a); - template <class Alloc> - priority_queue(const Compare& comp, Container&& c, - const Alloc& a); - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Alloc& a); - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& comp, const Alloc& a); - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& comp, const Container& c, const Alloc& a); - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& comp, Container&& c, const Alloc& a); - template <class Alloc> - priority_queue(const priority_queue& q, const Alloc& a); - template <class Alloc> - priority_queue(priority_queue&& q, const Alloc& a); - - bool empty() const; - size_type size() const; - const_reference top() const; - - void push(const value_type& v); - void push(value_type&& v); - template <class... Args> void emplace(Args&&... args); - void pop(); - - void swap(priority_queue& q) - noexcept(is_nothrow_swappable_v<Container> && - is_nothrow_swappable_v<Comp>) -}; - -template <class Compare, class Container> -priority_queue(Compare, Container) - -> priority_queue<typename Container::value_type, Container, Compare>; // C++17 - -template<class InputIterator, - class Compare = less<iter-value-type<InputIterator>>, - class Container = vector<iter-value-type<InputIterator>>> -priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container()) - -> priority_queue<iter-value-type<InputIterator>, Container, Compare>; // C++17 - -template<class Compare, class Container, class Allocator> -priority_queue(Compare, Container, Allocator) - -> priority_queue<typename Container::value_type, Container, Compare>; // C++17 - -template<class InputIterator, class Allocator> -priority_queue(InputIterator, InputIterator, Allocator) - -> priority_queue<iter-value-type<InputIterator>, - vector<iter-value-type<InputIterator>, Allocator>, - less<iter-value-type<InputIterator>>>; // C++17 - -template<class InputIterator, class Compare, class Allocator> -priority_queue(InputIterator, InputIterator, Compare, Allocator) - -> priority_queue<iter-value-type<InputIterator>, - vector<iter-value-type<InputIterator>, Allocator>, Compare>; // C++17 - -template<class InputIterator, class Compare, class Container, class Allocator> -priority_queue(InputIterator, InputIterator, Compare, Container, Allocator) - -> priority_queue<typename Container::value_type, Container, Compare>; // C++17 - -template <class T, class Container, class Compare> - void swap(priority_queue<T, Container, Compare>& x, - priority_queue<T, Container, Compare>& y) - noexcept(noexcept(x.swap(y))); - -} // std - -*/ - -#include <__algorithm/make_heap.h> -#include <__algorithm/pop_heap.h> -#include <__algorithm/push_heap.h> -#include <__config> -#include <__iterator/iterator_traits.h> -#include <__memory/uses_allocator.h> -#include <__utility/forward.h> -#include <compare> -#include <deque> -#include <functional> -#include <type_traits> -#include <vector> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS queue; - -template <class _Tp, class _Container> -_LIBCPP_INLINE_VISIBILITY -bool -operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); - -template <class _Tp, class _Container> -_LIBCPP_INLINE_VISIBILITY -bool -operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); - -template <class _Tp, class _Container /*= deque<_Tp>*/> -class _LIBCPP_TEMPLATE_VIS queue -{ -public: - typedef _Container container_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::const_reference const_reference; - typedef typename container_type::size_type size_type; - static_assert((is_same<_Tp, value_type>::value), "" ); - -protected: - container_type c; - -public: - _LIBCPP_INLINE_VISIBILITY - queue() - _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value) - : c() {} - - _LIBCPP_INLINE_VISIBILITY - queue(const queue& __q) : c(__q.c) {} - -#if _LIBCPP_STD_VER > 20 - template <class _InputIterator, - class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>> - _LIBCPP_HIDE_FROM_ABI - queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {} - - template <class _InputIterator, - class _Alloc, - class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>> - _LIBCPP_HIDE_FROM_ABI - queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc) : c(__first, __second, __alloc) {} -#endif - - _LIBCPP_INLINE_VISIBILITY - queue& operator=(const queue& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - queue(queue&& __q) - _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value) - : c(_VSTD::move(__q.c)) {} - - _LIBCPP_INLINE_VISIBILITY - queue& operator=(queue&& __q) - _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) - {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - explicit queue(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - explicit queue(const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(__a) {} - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - queue(const queue& __q, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(__q.c, __a) {} - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - queue(const container_type& __c, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(__c, __a) {} -#ifndef _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - queue(container_type&& __c, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(_VSTD::move(__c), __a) {} - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - queue(queue&& __q, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0) - : c(_VSTD::move(__q.c), __a) {} - -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const {return c.empty();} - _LIBCPP_INLINE_VISIBILITY - size_type size() const {return c.size();} - - _LIBCPP_INLINE_VISIBILITY - reference front() {return c.front();} - _LIBCPP_INLINE_VISIBILITY - const_reference front() const {return c.front();} - _LIBCPP_INLINE_VISIBILITY - reference back() {return c.back();} - _LIBCPP_INLINE_VISIBILITY - const_reference back() const {return c.back();} - - _LIBCPP_INLINE_VISIBILITY - void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_STD_VER > 14 - decltype(auto) emplace(_Args&&... __args) - { return c.emplace_back(_VSTD::forward<_Args>(__args)...);} -#else - void emplace(_Args&&... __args) - { c.emplace_back(_VSTD::forward<_Args>(__args)...);} -#endif -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void pop() {c.pop_front();} - - _LIBCPP_INLINE_VISIBILITY - void swap(queue& __q) - _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) - { - using _VSTD::swap; - swap(c, __q.c); - } - - template <class _T1, class _C1> - friend - _LIBCPP_INLINE_VISIBILITY - bool - operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); - - template <class _T1, class _C1> - friend - _LIBCPP_INLINE_VISIBILITY - bool - operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); -}; - -#if _LIBCPP_STD_VER > 14 -template<class _Container, - class = enable_if_t<!__is_allocator<_Container>::value> -> -queue(_Container) - -> queue<typename _Container::value_type, _Container>; - -template<class _Container, - class _Alloc, - class = enable_if_t<!__is_allocator<_Container>::value>, - class = enable_if_t<uses_allocator<_Container, _Alloc>::value> -> -queue(_Container, _Alloc) - -> queue<typename _Container::value_type, _Container>; -#endif - -#if _LIBCPP_STD_VER > 20 -template <class _InputIterator, - class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>> -queue(_InputIterator, _InputIterator) - -> queue<__iter_value_type<_InputIterator>>; - -template <class _InputIterator, - class _Alloc, - class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = __enable_if_t<__is_allocator<_Alloc>::value>> -queue(_InputIterator, _InputIterator, _Alloc) - -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>; -#endif - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) -{ - return __x.c == __y.c; -} - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) -{ - return __x.c < __y.c; -} - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) -{ - return !(__x == __y); -} - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) -{ - return __y < __x; -} - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) -{ - return !(__x < __y); -} - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) -{ - return !(__y < __x); -} - -template <class _Tp, class _Container> -inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t<__is_swappable<_Container>::value, void> -swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -template <class _Tp, class _Container, class _Alloc> -struct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc> - : public uses_allocator<_Container, _Alloc> -{ -}; - -template <class _Tp, class _Container = vector<_Tp>, - class _Compare = less<typename _Container::value_type> > -class _LIBCPP_TEMPLATE_VIS priority_queue -{ -public: - typedef _Container container_type; - typedef _Compare value_compare; - typedef typename container_type::value_type value_type; - typedef typename container_type::reference reference; - typedef typename container_type::const_reference const_reference; - typedef typename container_type::size_type size_type; - static_assert((is_same<_Tp, value_type>::value), "" ); - -protected: - container_type c; - value_compare comp; - -public: - _LIBCPP_INLINE_VISIBILITY - priority_queue() - _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value && - is_nothrow_default_constructible<value_compare>::value) - : c(), comp() {} - - _LIBCPP_INLINE_VISIBILITY - priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {} - - _LIBCPP_INLINE_VISIBILITY - priority_queue& operator=(const priority_queue& __q) - {c = __q.c; comp = __q.comp; return *this;} - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - priority_queue(priority_queue&& __q) - _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value && - is_nothrow_move_constructible<value_compare>::value) - : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {} - - _LIBCPP_INLINE_VISIBILITY - priority_queue& operator=(priority_queue&& __q) - _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value && - is_nothrow_move_assignable<value_compare>::value) - {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - explicit priority_queue(const value_compare& __comp) - : c(), comp(__comp) {} - _LIBCPP_INLINE_VISIBILITY - priority_queue(const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - priority_queue(const value_compare& __comp, container_type&& __c); -#endif - template <class _InputIter, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp = value_compare()); - template <class _InputIter, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_CXX03_LANG - template <class _InputIter, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, container_type&& __c); -#endif // _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - explicit priority_queue(const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - priority_queue(const value_compare& __comp, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - priority_queue(const value_compare& __comp, const container_type& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - priority_queue(const priority_queue& __q, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); -#ifndef _LIBCPP_CXX03_LANG - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - priority_queue(const value_compare& __comp, container_type&& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - template <class _Alloc> - _LIBCPP_INLINE_VISIBILITY - priority_queue(priority_queue&& __q, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); -#endif // _LIBCPP_CXX03_LANG - - template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - - template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - - template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, const container_type& __c, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); - -#ifndef _LIBCPP_CXX03_LANG - template <class _InputIter, class _Alloc, class = __enable_if_t<__is_cpp17_input_iterator<_InputIter>::value> > - _LIBCPP_INLINE_VISIBILITY - priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, container_type&& __c, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0); -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const {return c.empty();} - _LIBCPP_INLINE_VISIBILITY - size_type size() const {return c.size();} - _LIBCPP_INLINE_VISIBILITY - const_reference top() const {return c.front();} - - _LIBCPP_INLINE_VISIBILITY - void push(const value_type& __v); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void push(value_type&& __v); - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - void emplace(_Args&&... __args); -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void pop(); - - _LIBCPP_INLINE_VISIBILITY - void swap(priority_queue& __q) - _NOEXCEPT_(__is_nothrow_swappable<container_type>::value && - __is_nothrow_swappable<value_compare>::value); -}; - -#if _LIBCPP_STD_VER >= 17 -template <class _Compare, - class _Container, - class = enable_if_t<!__is_allocator<_Compare>::value>, - class = enable_if_t<!__is_allocator<_Container>::value> -> -priority_queue(_Compare, _Container) - -> priority_queue<typename _Container::value_type, _Container, _Compare>; - -template<class _InputIterator, - class _Compare = less<__iter_value_type<_InputIterator>>, - class _Container = vector<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Compare>::value>, - class = enable_if_t<!__is_allocator<_Container>::value> -> -priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container()) - -> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>; - -template<class _Compare, - class _Container, - class _Alloc, - class = enable_if_t<!__is_allocator<_Compare>::value>, - class = enable_if_t<!__is_allocator<_Container>::value>, - class = enable_if_t<uses_allocator<_Container, _Alloc>::value> -> -priority_queue(_Compare, _Container, _Alloc) - -> priority_queue<typename _Container::value_type, _Container, _Compare>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value> -> -priority_queue(_InputIterator, _InputIterator, _Allocator) - -> priority_queue<__iter_value_type<_InputIterator>, - vector<__iter_value_type<_InputIterator>, _Allocator>, - less<__iter_value_type<_InputIterator>>>; - -template<class _InputIterator, class _Compare, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Compare>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value> -> -priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator) - -> priority_queue<__iter_value_type<_InputIterator>, - vector<__iter_value_type<_InputIterator>, _Allocator>, _Compare>; - -template<class _InputIterator, class _Compare, class _Container, class _Alloc, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Compare>::value>, - class = enable_if_t<!__is_allocator<_Container>::value>, - class = enable_if_t<uses_allocator<_Container, _Alloc>::value> -> -priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc) - -> priority_queue<typename _Container::value_type, _Container, _Compare>; -#endif - -template <class _Tp, class _Container, class _Compare> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, - const container_type& __c) - : c(__c), - comp(__comp) -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, - container_type&& __c) - : c(_VSTD::move(__c)), - comp(__comp) -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp) - : c(__f, __l), - comp(__comp) -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, - const container_type& __c) - : c(__c), - comp(__comp) -{ - c.insert(c.end(), __f, __l); - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, - const value_compare& __comp, - container_type&& __c) - : c(_VSTD::move(__c)), - comp(__comp) -{ - c.insert(c.end(), __f, __l); - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__a) -{ -} - -template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__a), - comp(__comp) -{ -} - -template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, - const container_type& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__c, __a), - comp(__comp) -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__q.c, __a), - comp(__q.comp) -{ -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, - container_type&& __c, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(_VSTD::move(__c), __a), - comp(__comp) -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -template <class _Tp, class _Container, class _Compare> -template <class _Alloc> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, - const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(_VSTD::move(__q.c), __a), - comp(_VSTD::move(__q.comp)) -{ -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, _InputIter __l, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__f, __l, __a), - comp() -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, _InputIter __l, - const value_compare& __comp, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__f, __l, __a), - comp(__comp) -{ - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, _InputIter __l, - const value_compare& __comp, const container_type& __c, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(__c, __a), - comp(__comp) -{ - c.insert(c.end(), __f, __l); - _VSTD::make_heap(c.begin(), c.end(), comp); -} - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp, class _Container, class _Compare> -template <class _InputIter, class _Alloc, class> -inline -priority_queue<_Tp, _Container, _Compare>::priority_queue( - _InputIter __f, _InputIter __l, const value_compare& __comp, - container_type&& __c, const _Alloc& __a, - __enable_if_t<uses_allocator<container_type, _Alloc>::value>*) - : c(_VSTD::move(__c), __a), - comp(__comp) -{ - c.insert(c.end(), __f, __l); - _VSTD::make_heap(c.begin(), c.end(), comp); -} -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -inline -void -priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) -{ - c.push_back(__v); - _VSTD::push_heap(c.begin(), c.end(), comp); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -inline -void -priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) -{ - c.push_back(_VSTD::move(__v)); - _VSTD::push_heap(c.begin(), c.end(), comp); -} - -template <class _Tp, class _Container, class _Compare> -template <class... _Args> -inline -void -priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) -{ - c.emplace_back(_VSTD::forward<_Args>(__args)...); - _VSTD::push_heap(c.begin(), c.end(), comp); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Tp, class _Container, class _Compare> -inline -void -priority_queue<_Tp, _Container, _Compare>::pop() -{ - _VSTD::pop_heap(c.begin(), c.end(), comp); - c.pop_back(); -} - -template <class _Tp, class _Container, class _Compare> -inline -void -priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) - _NOEXCEPT_(__is_nothrow_swappable<container_type>::value && - __is_nothrow_swappable<value_compare>::value) -{ - using _VSTD::swap; - swap(c, __q.c); - swap(comp, __q.comp); -} - -template <class _Tp, class _Container, class _Compare> -inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t< - __is_swappable<_Container>::value && __is_swappable<_Compare>::value, - void -> -swap(priority_queue<_Tp, _Container, _Compare>& __x, - priority_queue<_Tp, _Container, _Compare>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -template <class _Tp, class _Container, class _Compare, class _Alloc> -struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc> - : public uses_allocator<_Container, _Alloc> -{ -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_QUEUE diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/ranges b/contrib/libs/cxxsupp/libcxxmsvc/include/ranges deleted file mode 100644 index 25ed65ba1e..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/ranges +++ /dev/null @@ -1,269 +0,0 @@ -// -*- 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 -#define _LIBCPP_RANGES - -/* - -#include <compare> // see [compare.syn] -#include <initializer_list> // see [initializer.list.syn] -#include <iterator> // see [iterator.synopsis] - -namespace std::ranges { - inline namespace unspecified { - // [range.access], range access - inline constexpr unspecified begin = unspecified; - inline constexpr unspecified end = unspecified; - inline constexpr unspecified cbegin = unspecified; - inline constexpr unspecified cend = unspecified; - - inline constexpr unspecified size = unspecified; - inline constexpr unspecified ssize = unspecified; - } - - // [range.range], ranges - template<class T> - concept range = see below; - - template<class T> - inline constexpr bool enable_borrowed_range = false; - - template<class T> - using iterator_t = decltype(ranges::begin(declval<T&>())); - template<range R> - using sentinel_t = decltype(ranges::end(declval<R&>())); - template<range R> - using range_difference_t = iter_difference_t<iterator_t<R>>; - template<sized_range R> - using range_size_t = decltype(ranges::size(declval<R&>())); - template<range R> - using range_value_t = iter_value_t<iterator_t<R>>; - template<range R> - using range_reference_t = iter_reference_t<iterator_t<R>>; - template<range R> - using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>; - - // [range.sized], sized ranges - template<class> - inline constexpr bool disable_sized_range = false; - - template<class T> - concept sized_range = ...; - - // [range.view], views - template<class T> - inline constexpr bool enable_view = ...; - - struct view_base { }; - - template<class T> - concept view = ...; - - // [range.refinements], other range refinements - template<class R, class T> - concept output_range = see below; - - template<class T> - concept input_range = see below; - - template<class T> - concept forward_range = see below; - - template<class T> - concept bidirectional_range = see below; - - template<class T> - concept random_access_range = see below; - - template<class T> - concept contiguous_range = see below; - - template <class _Tp> - concept common_range = see below; - - template<class T> - concept viewable_range = see below; - - // [view.interface], class template view_interface - template<class D> - requires is_class_v<D> && same_as<D, remove_cv_t<D>> - class view_interface; - - // [range.subrange], sub-ranges - enum class subrange_kind : bool { unsized, sized }; - - template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below> - requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>) - class subrange; - - template<class I, class S, subrange_kind K> - inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true; - - // [range.dangling], dangling iterator handling - struct dangling; - - template<range R> - using borrowed_iterator_t = see below; - - template<range R> - using borrowed_subrange_t = see below; - - // [range.empty], empty view - template<class T> - requires is_object_v<T> - class empty_view; - - // [range.all], all view - namespace views { - inline constexpr unspecified all = unspecified; - - template<viewable_range R> - using all_t = decltype(all(declval<R>())); - } - - template<range R> - requires is_object_v<R> - class ref_view; - - 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; - - template<class T> - inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>; - - // [range.transform], transform view - template<input_range V, copy_constructible F> - requires view<V> && is_object_v<F> && - regular_invocable<F&, range_reference_t<V>> && - can-reference<invoke_result_t<F&, range_reference_t<V>>> - class transform_view; - - // [range.counted], counted view - namespace views { inline constexpr unspecified counted = unspecified; } - - // [range.common], common view - template<view V> - requires (!common_range<V> && copyable<iterator_t<V>>) - class common_view; - - // [range.reverse], reverse view - template<view V> - requires bidirectional_range<V> - class reverse_view; - - template<class T> - inline constexpr bool enable_borrowed_range<reverse_view<T>> = enable_borrowed_range<T>; - - template<class T> - inline constexpr bool enable_borrowed_range<common_view<T>> = enable_borrowed_range<T>; - - // [range.take], take view - template<view> class take_view; - - template<class T> - inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>; - - template<copy_constructible T> - requires is_object_v<T> - class single_view; - - template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t> - requires weakly-equality-comparable-with<W, Bound> && copyable<W> - class iota_view; - - template<class W, class Bound> - inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true; - - // [range.join], join view - template<input_range V> - requires view<V> && input_range<range_reference_t<V>> - class join_view; -} - -namespace std { - namespace views = ranges::views; - - template<class T> struct tuple_size; - template<size_t I, class T> struct tuple_element; - - template<class I, class S, ranges::subrange_kind K> - struct tuple_size<ranges::subrange<I, S, K>> - : integral_constant<size_t, 2> {}; - - template<class I, class S, ranges::subrange_kind K> - struct tuple_element<0, ranges::subrange<I, S, K>> { - using type = I; - }; - - template<class I, class S, ranges::subrange_kind K> - struct tuple_element<1, ranges::subrange<I, S, K>> { - using type = S; - }; - - template<class I, class S, ranges::subrange_kind K> - struct tuple_element<0, const ranges::subrange<I, S, K>> { - using type = I; - }; - - template<class I, class S, ranges::subrange_kind K> - struct tuple_element<1, const ranges::subrange<I, S, K>> { - using type = S; - }; -} -*/ - -#include <__config> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/common_view.h> -#include <__ranges/concepts.h> -#include <__ranges/counted.h> -#include <__ranges/dangling.h> -#include <__ranges/data.h> -#include <__ranges/drop_view.h> -#include <__ranges/empty.h> -#include <__ranges/empty_view.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/enable_view.h> -#include <__ranges/iota_view.h> -#include <__ranges/join_view.h> -#include <__ranges/rbegin.h> -#include <__ranges/ref_view.h> -#include <__ranges/rend.h> -#include <__ranges/reverse_view.h> -#include <__ranges/single_view.h> -#include <__ranges/size.h> -#include <__ranges/subrange.h> -#include <__ranges/take_view.h> -#include <__ranges/transform_view.h> -#include <__ranges/view_interface.h> -#include <__ranges/views.h> -#include <compare> // Required by the standard. -#include <initializer_list> // Required by the standard. -#include <iterator> // Required by the standard. -#include <type_traits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#endif // _LIBCPP_RANGES diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/set b/contrib/libs/cxxsupp/libcxxmsvc/include/set deleted file mode 100644 index 176369e81b..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/set +++ /dev/null @@ -1,1564 +0,0 @@ -// -*- 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_SET -#define _LIBCPP_SET - -/* - - set synopsis - -namespace std -{ - -template <class Key, class Compare = less<Key>, - class Allocator = allocator<Key>> -class set -{ -public: - // types: - typedef Key key_type; - typedef key_type value_type; - typedef Compare key_compare; - typedef key_compare value_compare; - typedef Allocator allocator_type; - typedef typename allocator_type::reference reference; - typedef typename allocator_type::const_reference const_reference; - typedef typename allocator_type::size_type size_type; - typedef typename allocator_type::difference_type difference_type; - typedef typename allocator_type::pointer pointer; - typedef typename allocator_type::const_pointer const_pointer; - - typedef implementation-defined iterator; - typedef implementation-defined const_iterator; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - typedef unspecified node_type; // C++17 - typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 - - // construct/copy/destroy: - set() - noexcept( - is_nothrow_default_constructible<allocator_type>::value && - is_nothrow_default_constructible<key_compare>::value && - is_nothrow_copy_constructible<key_compare>::value); - explicit set(const value_compare& comp); - set(const value_compare& comp, const allocator_type& a); - template <class InputIterator> - set(InputIterator first, InputIterator last, - const value_compare& comp = value_compare()); - template <class InputIterator> - set(InputIterator first, InputIterator last, const value_compare& comp, - const allocator_type& a); - set(const set& s); - set(set&& s) - noexcept( - is_nothrow_move_constructible<allocator_type>::value && - is_nothrow_move_constructible<key_compare>::value); - explicit set(const allocator_type& a); - set(const set& s, const allocator_type& a); - set(set&& s, const allocator_type& a); - set(initializer_list<value_type> il, const value_compare& comp = value_compare()); - set(initializer_list<value_type> il, const value_compare& comp, - const allocator_type& a); - template <class InputIterator> - set(InputIterator first, InputIterator last, const allocator_type& a) - : set(first, last, Compare(), a) {} // C++14 - set(initializer_list<value_type> il, const allocator_type& a) - : set(il, Compare(), a) {} // C++14 - ~set(); - - set& operator=(const set& s); - set& operator=(set&& s) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<key_compare>::value); - set& operator=(initializer_list<value_type> il); - - // iterators: - iterator begin() noexcept; - const_iterator begin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; - - reverse_iterator rbegin() noexcept; - const_reverse_iterator rbegin() const noexcept; - reverse_iterator rend() noexcept; - const_reverse_iterator rend() const noexcept; - - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - const_reverse_iterator crbegin() const noexcept; - const_reverse_iterator crend() const noexcept; - - // capacity: - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - // modifiers: - template <class... Args> - pair<iterator, bool> emplace(Args&&... args); - template <class... Args> - iterator emplace_hint(const_iterator position, Args&&... args); - pair<iterator,bool> insert(const value_type& v); - pair<iterator,bool> insert(value_type&& v); - iterator insert(const_iterator position, const value_type& v); - iterator insert(const_iterator position, value_type&& v); - template <class InputIterator> - void insert(InputIterator first, InputIterator last); - void insert(initializer_list<value_type> il); - - node_type extract(const_iterator position); // C++17 - node_type extract(const key_type& x); // C++17 - insert_return_type insert(node_type&& nh); // C++17 - iterator insert(const_iterator hint, node_type&& nh); // C++17 - - iterator erase(const_iterator position); - iterator erase(iterator position); // C++14 - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - template<class C2> - void merge(set<Key, C2, Allocator>& source); // C++17 - template<class C2> - void merge(set<Key, C2, Allocator>&& source); // C++17 - template<class C2> - void merge(multiset<Key, C2, Allocator>& source); // C++17 - template<class C2> - void merge(multiset<Key, C2, Allocator>&& source); // C++17 - - void swap(set& s) - noexcept( - __is_nothrow_swappable<key_compare>::value && - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable<allocator_type>::value)); - - // observers: - allocator_type get_allocator() const noexcept; - key_compare key_comp() const; - value_compare value_comp() const; - - // set operations: - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - template<typename K> - iterator find(const K& x); - template<typename K> - const_iterator find(const K& x) const; // C++14 - - template<typename K> - size_type count(const K& x) const; // C++14 - size_type count(const key_type& k) const; - - bool contains(const key_type& x) const; // C++20 - template<class K> bool contains(const K& x) const; // C++20 - - iterator lower_bound(const key_type& k); - const_iterator lower_bound(const key_type& k) const; - template<typename K> - iterator lower_bound(const K& x); // C++14 - template<typename K> - const_iterator lower_bound(const K& x) const; // C++14 - - iterator upper_bound(const key_type& k); - const_iterator upper_bound(const key_type& k) const; - template<typename K> - iterator upper_bound(const K& x); // C++14 - template<typename K> - const_iterator upper_bound(const K& x) const; // C++14 - pair<iterator,iterator> equal_range(const key_type& k); - pair<const_iterator,const_iterator> equal_range(const key_type& k) const; - template<typename K> - pair<iterator,iterator> equal_range(const K& x); // C++14 - template<typename K> - pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 -}; - -template <class InputIterator, - class Compare = less<typename iterator_traits<InputIterator>::value_type>, - class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> -set(InputIterator, InputIterator, - Compare = Compare(), Allocator = Allocator()) - -> set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>; // C++17 - -template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> -set(initializer_list<Key>, Compare = Compare(), Allocator = Allocator()) - -> set<Key, Compare, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -set(InputIterator, InputIterator, Allocator) - -> set<typename iterator_traits<InputIterator>::value_type, - less<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 - -template<class Key, class Allocator> -set(initializer_list<Key>, Allocator) -> set<Key, less<Key>, Allocator>; // C++17 - -template <class Key, class Compare, class Allocator> -bool -operator==(const set<Key, Compare, Allocator>& x, - const set<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator< (const set<Key, Compare, Allocator>& x, - const set<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator!=(const set<Key, Compare, Allocator>& x, - const set<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator> (const set<Key, Compare, Allocator>& x, - const set<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator>=(const set<Key, Compare, Allocator>& x, - const set<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator<=(const set<Key, Compare, Allocator>& x, - const set<Key, Compare, Allocator>& y); - -// specialized algorithms: -template <class Key, class Compare, class Allocator> -void -swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) - noexcept(noexcept(x.swap(y))); - -template <class Key, class Compare, class Allocator, class Predicate> -typename set<Key, Compare, Allocator>::size_type -erase_if(set<Key, Compare, Allocator>& c, Predicate pred); // C++20 - -template <class Key, class Compare = less<Key>, - class Allocator = allocator<Key>> -class multiset -{ -public: - // types: - typedef Key key_type; - typedef key_type value_type; - typedef Compare key_compare; - typedef key_compare value_compare; - typedef Allocator allocator_type; - typedef typename allocator_type::reference reference; - typedef typename allocator_type::const_reference const_reference; - typedef typename allocator_type::size_type size_type; - typedef typename allocator_type::difference_type difference_type; - typedef typename allocator_type::pointer pointer; - typedef typename allocator_type::const_pointer const_pointer; - - typedef implementation-defined iterator; - typedef implementation-defined const_iterator; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - typedef unspecified node_type; // C++17 - - // construct/copy/destroy: - multiset() - noexcept( - is_nothrow_default_constructible<allocator_type>::value && - is_nothrow_default_constructible<key_compare>::value && - is_nothrow_copy_constructible<key_compare>::value); - explicit multiset(const value_compare& comp); - multiset(const value_compare& comp, const allocator_type& a); - template <class InputIterator> - multiset(InputIterator first, InputIterator last, - const value_compare& comp = value_compare()); - template <class InputIterator> - multiset(InputIterator first, InputIterator last, - const value_compare& comp, const allocator_type& a); - multiset(const multiset& s); - multiset(multiset&& s) - noexcept( - is_nothrow_move_constructible<allocator_type>::value && - is_nothrow_move_constructible<key_compare>::value); - explicit multiset(const allocator_type& a); - multiset(const multiset& s, const allocator_type& a); - multiset(multiset&& s, const allocator_type& a); - multiset(initializer_list<value_type> il, const value_compare& comp = value_compare()); - multiset(initializer_list<value_type> il, const value_compare& comp, - const allocator_type& a); - template <class InputIterator> - multiset(InputIterator first, InputIterator last, const allocator_type& a) - : set(first, last, Compare(), a) {} // C++14 - multiset(initializer_list<value_type> il, const allocator_type& a) - : set(il, Compare(), a) {} // C++14 - ~multiset(); - - multiset& operator=(const multiset& s); - multiset& operator=(multiset&& s) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<key_compare>::value); - multiset& operator=(initializer_list<value_type> il); - - // iterators: - iterator begin() noexcept; - const_iterator begin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; - - reverse_iterator rbegin() noexcept; - const_reverse_iterator rbegin() const noexcept; - reverse_iterator rend() noexcept; - const_reverse_iterator rend() const noexcept; - - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - const_reverse_iterator crbegin() const noexcept; - const_reverse_iterator crend() const noexcept; - - // capacity: - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - // modifiers: - template <class... Args> - iterator emplace(Args&&... args); - template <class... Args> - iterator emplace_hint(const_iterator position, Args&&... args); - iterator insert(const value_type& v); - iterator insert(value_type&& v); - iterator insert(const_iterator position, const value_type& v); - iterator insert(const_iterator position, value_type&& v); - template <class InputIterator> - void insert(InputIterator first, InputIterator last); - void insert(initializer_list<value_type> il); - - node_type extract(const_iterator position); // C++17 - node_type extract(const key_type& x); // C++17 - iterator insert(node_type&& nh); // C++17 - iterator insert(const_iterator hint, node_type&& nh); // C++17 - - iterator erase(const_iterator position); - iterator erase(iterator position); // C++14 - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - template<class C2> - void merge(multiset<Key, C2, Allocator>& source); // C++17 - template<class C2> - void merge(multiset<Key, C2, Allocator>&& source); // C++17 - template<class C2> - void merge(set<Key, C2, Allocator>& source); // C++17 - template<class C2> - void merge(set<Key, C2, Allocator>&& source); // C++17 - - void swap(multiset& s) - noexcept( - __is_nothrow_swappable<key_compare>::value && - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable<allocator_type>::value)); - - // observers: - allocator_type get_allocator() const noexcept; - key_compare key_comp() const; - value_compare value_comp() const; - - // set operations: - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - template<typename K> - iterator find(const K& x); - template<typename K> - const_iterator find(const K& x) const; // C++14 - - template<typename K> - size_type count(const K& x) const; // C++14 - size_type count(const key_type& k) const; - - bool contains(const key_type& x) const; // C++20 - template<class K> bool contains(const K& x) const; // C++20 - - iterator lower_bound(const key_type& k); - const_iterator lower_bound(const key_type& k) const; - template<typename K> - iterator lower_bound(const K& x); // C++14 - template<typename K> - const_iterator lower_bound(const K& x) const; // C++14 - - iterator upper_bound(const key_type& k); - const_iterator upper_bound(const key_type& k) const; - template<typename K> - iterator upper_bound(const K& x); // C++14 - template<typename K> - const_iterator upper_bound(const K& x) const; // C++14 - - pair<iterator,iterator> equal_range(const key_type& k); - pair<const_iterator,const_iterator> equal_range(const key_type& k) const; - template<typename K> - pair<iterator,iterator> equal_range(const K& x); // C++14 - template<typename K> - pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 -}; - -template <class InputIterator, - class Compare = less<typename iterator_traits<InputIterator>::value_type>, - class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> -multiset(InputIterator, InputIterator, - Compare = Compare(), Allocator = Allocator()) - -> multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>; // C++17 - -template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> -multiset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator()) - -> multiset<Key, Compare, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -multiset(InputIterator, InputIterator, Allocator) - -> multiset<typename iterator_traits<InputIterator>::value_type, - less<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 - -template<class Key, class Allocator> -multiset(initializer_list<Key>, Allocator) -> multiset<Key, less<Key>, Allocator>; // C++17 - -template <class Key, class Compare, class Allocator> -bool -operator==(const multiset<Key, Compare, Allocator>& x, - const multiset<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator< (const multiset<Key, Compare, Allocator>& x, - const multiset<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator!=(const multiset<Key, Compare, Allocator>& x, - const multiset<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator> (const multiset<Key, Compare, Allocator>& x, - const multiset<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator>=(const multiset<Key, Compare, Allocator>& x, - const multiset<Key, Compare, Allocator>& y); - -template <class Key, class Compare, class Allocator> -bool -operator<=(const multiset<Key, Compare, Allocator>& x, - const multiset<Key, Compare, Allocator>& y); - -// specialized algorithms: -template <class Key, class Compare, class Allocator> -void -swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) - noexcept(noexcept(x.swap(y))); - -template <class Key, class Compare, class Allocator, class Predicate> -typename multiset<Key, Compare, Allocator>::size_type -erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 - -} // std - -*/ - -#include <__algorithm/equal.h> -#include <__algorithm/lexicographical_compare.h> -#include <__assert> -#include <__config> -#include <__functional/is_transparent.h> -#include <__iterator/iterator_traits.h> -#include <__node_handle> -#include <__tree> -#include <__utility/forward.h> -#include <compare> -#include <functional> -#include <initializer_list> -#include <iterator> // __libcpp_erase_if_container -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Key, class _Compare, class _Allocator> -class multiset; - -template <class _Key, class _Compare = less<_Key>, - class _Allocator = allocator<_Key> > -class _LIBCPP_TEMPLATE_VIS set -{ -public: - // types: - typedef _Key key_type; - typedef key_type value_type; - typedef __identity_t<_Compare> key_compare; - typedef key_compare value_compare; - typedef __identity_t<_Allocator> allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - - static_assert((is_same<typename allocator_type::value_type, value_type>::value), - "Allocator::value_type must be same type as value_type"); - -private: - typedef __tree<value_type, value_compare, allocator_type> __base; - typedef allocator_traits<allocator_type> __alloc_traits; - - __base __tree_; - -public: - typedef typename __base::pointer pointer; - typedef typename __base::const_pointer const_pointer; - typedef typename __base::size_type size_type; - typedef typename __base::difference_type difference_type; - typedef typename __base::const_iterator iterator; - typedef typename __base::const_iterator const_iterator; - typedef _VSTD::reverse_iterator<iterator> reverse_iterator; - typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; - -#if _LIBCPP_STD_VER > 14 - typedef __set_node_handle<typename __base::__node, allocator_type> node_type; - typedef __insert_return_type<iterator, node_type> insert_return_type; -#endif - - template <class _Key2, class _Compare2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS set; - template <class _Key2, class _Compare2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS multiset; - - _LIBCPP_INLINE_VISIBILITY - set() - _NOEXCEPT_( - is_nothrow_default_constructible<allocator_type>::value && - is_nothrow_default_constructible<key_compare>::value && - is_nothrow_copy_constructible<key_compare>::value) - : __tree_(value_compare()) {} - - _LIBCPP_INLINE_VISIBILITY - explicit set(const value_compare& __comp) - _NOEXCEPT_( - is_nothrow_default_constructible<allocator_type>::value && - is_nothrow_copy_constructible<key_compare>::value) - : __tree_(__comp) {} - - _LIBCPP_INLINE_VISIBILITY - explicit set(const value_compare& __comp, const allocator_type& __a) - : __tree_(__comp, __a) {} - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - set(_InputIterator __f, _InputIterator __l, - const value_compare& __comp = value_compare()) - : __tree_(__comp) - { - insert(__f, __l); - } - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, - const allocator_type& __a) - : __tree_(__comp, __a) - { - insert(__f, __l); - } - -#if _LIBCPP_STD_VER > 11 - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) - : set(__f, __l, key_compare(), __a) {} -#endif - - _LIBCPP_INLINE_VISIBILITY - set(const set& __s) - : __tree_(__s.__tree_) - { - insert(__s.begin(), __s.end()); - } - - _LIBCPP_INLINE_VISIBILITY - set& operator=(const set& __s) - { - __tree_ = __s.__tree_; - return *this; - } - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - set(set&& __s) - _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) - : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - explicit set(const allocator_type& __a) - : __tree_(__a) {} - - _LIBCPP_INLINE_VISIBILITY - set(const set& __s, const allocator_type& __a) - : __tree_(__s.__tree_.value_comp(), __a) - { - insert(__s.begin(), __s.end()); - } - -#ifndef _LIBCPP_CXX03_LANG - set(set&& __s, const allocator_type& __a); - - _LIBCPP_INLINE_VISIBILITY - set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) - : __tree_(__comp) - { - insert(__il.begin(), __il.end()); - } - - _LIBCPP_INLINE_VISIBILITY - set(initializer_list<value_type> __il, const value_compare& __comp, - const allocator_type& __a) - : __tree_(__comp, __a) - { - insert(__il.begin(), __il.end()); - } - -#if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY - set(initializer_list<value_type> __il, const allocator_type& __a) - : set(__il, key_compare(), __a) {} -#endif - - _LIBCPP_INLINE_VISIBILITY - set& operator=(initializer_list<value_type> __il) - { - __tree_.__assign_unique(__il.begin(), __il.end()); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - set& operator=(set&& __s) - _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) - { - __tree_ = _VSTD::move(__s.__tree_); - return *this; - } -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - ~set() { - static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); - } - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return __tree_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return __tree_.begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return __tree_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return __tree_.end();} - - _LIBCPP_INLINE_VISIBILITY - reverse_iterator rbegin() _NOEXCEPT - {return reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rbegin() const _NOEXCEPT - {return const_reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - reverse_iterator rend() _NOEXCEPT - {return reverse_iterator(begin());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rend() const _NOEXCEPT - {return const_reverse_iterator(begin());} - - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return end();} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crend() const _NOEXCEPT {return rend();} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __tree_.size() == 0;} - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return __tree_.size();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT {return __tree_.max_size();} - - // modifiers: -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> emplace(_Args&&... __args) - {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p, _Args&&... __args) - {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - pair<iterator,bool> insert(const value_type& __v) - {return __tree_.__insert_unique(__v);} - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, const value_type& __v) - {return __tree_.__insert_unique(__p, __v);} - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __f, _InputIterator __l) - { - for (const_iterator __e = cend(); __f != __l; ++__f) - __tree_.__insert_unique(__e, *__f); - } - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - pair<iterator,bool> insert(value_type&& __v) - {return __tree_.__insert_unique(_VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_unique(__p, _VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __p) {return __tree_.erase(__p);} - _LIBCPP_INLINE_VISIBILITY - size_type erase(const key_type& __k) - {return __tree_.__erase_unique(__k);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __f, const_iterator __l) - {return __tree_.erase(__f, __l);} - _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {__tree_.clear();} - -#if _LIBCPP_STD_VER > 14 - _LIBCPP_INLINE_VISIBILITY - insert_return_type insert(node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to set::insert()"); - return __tree_.template __node_handle_insert_unique< - node_type, insert_return_type>(_VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __hint, node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to set::insert()"); - return __tree_.template __node_handle_insert_unique<node_type>( - __hint, _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(key_type const& __key) - { - return __tree_.template __node_handle_extract<node_type>(__key); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(const_iterator __it) - { - return __tree_.template __node_handle_extract<node_type>(__it); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(set<key_type, _Compare2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_unique(__source.__tree_); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(set<key_type, _Compare2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_unique(__source.__tree_); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(multiset<key_type, _Compare2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_unique(__source.__tree_); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(multiset<key_type, _Compare2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_unique(__source.__tree_); - } -#endif - - _LIBCPP_INLINE_VISIBILITY - void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) - {__tree_.swap(__s.__tree_);} - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} - _LIBCPP_INLINE_VISIBILITY - key_compare key_comp() const {return __tree_.value_comp();} - _LIBCPP_INLINE_VISIBILITY - value_compare value_comp() const {return __tree_.value_comp();} - - // set operations: - _LIBCPP_INLINE_VISIBILITY - iterator find(const key_type& __k) {return __tree_.find(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const key_type& __k) const {return __tree_.find(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type - find(const _K2& __k) {return __tree_.find(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type - find(const _K2& __k) const {return __tree_.find(__k);} -#endif - - _LIBCPP_INLINE_VISIBILITY - size_type count(const key_type& __k) const - {return __tree_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) const {return __tree_.__count_multi(__k);} -#endif - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type - contains(const _K2& __k) const { return find(__k) != end(); } -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - iterator lower_bound(const key_type& __k) - {return __tree_.lower_bound(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator lower_bound(const key_type& __k) const - {return __tree_.lower_bound(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type - lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} - - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type - lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} -#endif - - _LIBCPP_INLINE_VISIBILITY - iterator upper_bound(const key_type& __k) - {return __tree_.upper_bound(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator upper_bound(const key_type& __k) const - {return __tree_.upper_bound(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type - upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type - upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} -#endif - - _LIBCPP_INLINE_VISIBILITY - pair<iterator,iterator> equal_range(const key_type& __k) - {return __tree_.__equal_range_unique(__k);} - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator,const_iterator> equal_range(const key_type& __k) const - {return __tree_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type - equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type - equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} -#endif -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Compare = less<__iter_value_type<_InputIterator>>, - class _Allocator = allocator<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>, - class = enable_if_t<__is_allocator<_Allocator>::value, void>, - class = enable_if_t<!__is_allocator<_Compare>::value, void>> -set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) - -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>; - -template<class _Key, class _Compare = less<_Key>, - class _Allocator = allocator<_Key>, - class = enable_if_t<!__is_allocator<_Compare>::value, void>, - class = enable_if_t<__is_allocator<_Allocator>::value, void>> -set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) - -> set<_Key, _Compare, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>, - class = enable_if_t<__is_allocator<_Allocator>::value, void>> -set(_InputIterator, _InputIterator, _Allocator) - -> set<__iter_value_type<_InputIterator>, - less<__iter_value_type<_InputIterator>>, _Allocator>; - -template<class _Key, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value, void>> -set(initializer_list<_Key>, _Allocator) - -> set<_Key, less<_Key>, _Allocator>; -#endif - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Key, class _Compare, class _Allocator> -set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) - : __tree_(_VSTD::move(__s.__tree_), __a) -{ - if (__a != __s.get_allocator()) - { - const_iterator __e = cend(); - while (!__s.empty()) - insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); - } -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const set<_Key, _Compare, _Allocator>& __x, - const set<_Key, _Compare, _Allocator>& __y) -{ - return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator< (const set<_Key, _Compare, _Allocator>& __x, - const set<_Key, _Compare, _Allocator>& __y) -{ - return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const set<_Key, _Compare, _Allocator>& __x, - const set<_Key, _Compare, _Allocator>& __y) -{ - return !(__x == __y); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator> (const set<_Key, _Compare, _Allocator>& __x, - const set<_Key, _Compare, _Allocator>& __y) -{ - return __y < __x; -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator>=(const set<_Key, _Compare, _Allocator>& __x, - const set<_Key, _Compare, _Allocator>& __y) -{ - return !(__x < __y); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<=(const set<_Key, _Compare, _Allocator>& __x, - const set<_Key, _Compare, _Allocator>& __y) -{ - return !(__y < __x); -} - -// specialized algorithms: -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(set<_Key, _Compare, _Allocator>& __x, - set<_Key, _Compare, _Allocator>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Key, class _Compare, class _Allocator, class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename set<_Key, _Compare, _Allocator>::size_type - erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { - return _VSTD::__libcpp_erase_if_container(__c, __pred); -} -#endif - -template <class _Key, class _Compare = less<_Key>, - class _Allocator = allocator<_Key> > -class _LIBCPP_TEMPLATE_VIS multiset -{ -public: - // types: - typedef _Key key_type; - typedef key_type value_type; - typedef __identity_t<_Compare> key_compare; - typedef key_compare value_compare; - typedef __identity_t<_Allocator> allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - - static_assert((is_same<typename allocator_type::value_type, value_type>::value), - "Allocator::value_type must be same type as value_type"); - -private: - typedef __tree<value_type, value_compare, allocator_type> __base; - typedef allocator_traits<allocator_type> __alloc_traits; - - __base __tree_; - -public: - typedef typename __base::pointer pointer; - typedef typename __base::const_pointer const_pointer; - typedef typename __base::size_type size_type; - typedef typename __base::difference_type difference_type; - typedef typename __base::const_iterator iterator; - typedef typename __base::const_iterator const_iterator; - typedef _VSTD::reverse_iterator<iterator> reverse_iterator; - typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; - -#if _LIBCPP_STD_VER > 14 - typedef __set_node_handle<typename __base::__node, allocator_type> node_type; -#endif - - template <class _Key2, class _Compare2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS set; - template <class _Key2, class _Compare2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS multiset; - - // construct/copy/destroy: - _LIBCPP_INLINE_VISIBILITY - multiset() - _NOEXCEPT_( - is_nothrow_default_constructible<allocator_type>::value && - is_nothrow_default_constructible<key_compare>::value && - is_nothrow_copy_constructible<key_compare>::value) - : __tree_(value_compare()) {} - - _LIBCPP_INLINE_VISIBILITY - explicit multiset(const value_compare& __comp) - _NOEXCEPT_( - is_nothrow_default_constructible<allocator_type>::value && - is_nothrow_copy_constructible<key_compare>::value) - : __tree_(__comp) {} - - _LIBCPP_INLINE_VISIBILITY - explicit multiset(const value_compare& __comp, const allocator_type& __a) - : __tree_(__comp, __a) {} - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - multiset(_InputIterator __f, _InputIterator __l, - const value_compare& __comp = value_compare()) - : __tree_(__comp) - { - insert(__f, __l); - } - -#if _LIBCPP_STD_VER > 11 - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) - : multiset(__f, __l, key_compare(), __a) {} -#endif - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - multiset(_InputIterator __f, _InputIterator __l, - const value_compare& __comp, const allocator_type& __a) - : __tree_(__comp, __a) - { - insert(__f, __l); - } - - _LIBCPP_INLINE_VISIBILITY - multiset(const multiset& __s) - : __tree_(__s.__tree_.value_comp(), - __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) - { - insert(__s.begin(), __s.end()); - } - - _LIBCPP_INLINE_VISIBILITY - multiset& operator=(const multiset& __s) - { - __tree_ = __s.__tree_; - return *this; - } - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - multiset(multiset&& __s) - _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) - : __tree_(_VSTD::move(__s.__tree_)) {} - - multiset(multiset&& __s, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - explicit multiset(const allocator_type& __a) - : __tree_(__a) {} - _LIBCPP_INLINE_VISIBILITY - multiset(const multiset& __s, const allocator_type& __a) - : __tree_(__s.__tree_.value_comp(), __a) - { - insert(__s.begin(), __s.end()); - } - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) - : __tree_(__comp) - { - insert(__il.begin(), __il.end()); - } - - _LIBCPP_INLINE_VISIBILITY - multiset(initializer_list<value_type> __il, const value_compare& __comp, - const allocator_type& __a) - : __tree_(__comp, __a) - { - insert(__il.begin(), __il.end()); - } - -#if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY - multiset(initializer_list<value_type> __il, const allocator_type& __a) - : multiset(__il, key_compare(), __a) {} -#endif - - _LIBCPP_INLINE_VISIBILITY - multiset& operator=(initializer_list<value_type> __il) - { - __tree_.__assign_multi(__il.begin(), __il.end()); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - multiset& operator=(multiset&& __s) - _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) - { - __tree_ = _VSTD::move(__s.__tree_); - return *this; - } -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - ~multiset() { - static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); - } - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return __tree_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return __tree_.begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return __tree_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return __tree_.end();} - - _LIBCPP_INLINE_VISIBILITY - reverse_iterator rbegin() _NOEXCEPT - {return reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rbegin() const _NOEXCEPT - {return const_reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY - reverse_iterator rend() _NOEXCEPT - {return reverse_iterator(begin());} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rend() const _NOEXCEPT - {return const_reverse_iterator(begin());} - - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return end();} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} - _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crend() const _NOEXCEPT {return rend();} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __tree_.size() == 0;} - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return __tree_.size();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT {return __tree_.max_size();} - - // modifiers: -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator emplace(_Args&&... __args) - {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p, _Args&&... __args) - {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const value_type& __v) - {return __tree_.__insert_multi(__v);} - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, const value_type& __v) - {return __tree_.__insert_multi(__p, __v);} - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __f, _InputIterator __l) - { - for (const_iterator __e = cend(); __f != __l; ++__f) - __tree_.__insert_multi(__e, *__f); - } - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __v) - {return __tree_.__insert_multi(_VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_multi(__p, _VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __p) {return __tree_.erase(__p);} - _LIBCPP_INLINE_VISIBILITY - size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __f, const_iterator __l) - {return __tree_.erase(__f, __l);} - _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {__tree_.clear();} - -#if _LIBCPP_STD_VER > 14 - _LIBCPP_INLINE_VISIBILITY - iterator insert(node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to multiset::insert()"); - return __tree_.template __node_handle_insert_multi<node_type>( - _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __hint, node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to multiset::insert()"); - return __tree_.template __node_handle_insert_multi<node_type>( - __hint, _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(key_type const& __key) - { - return __tree_.template __node_handle_extract<node_type>(__key); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(const_iterator __it) - { - return __tree_.template __node_handle_extract<node_type>(__it); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(multiset<key_type, _Compare2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_multi(__source.__tree_); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(multiset<key_type, _Compare2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_multi(__source.__tree_); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(set<key_type, _Compare2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_multi(__source.__tree_); - } - template <class _Compare2> - _LIBCPP_INLINE_VISIBILITY - void merge(set<key_type, _Compare2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __tree_.__node_handle_merge_multi(__source.__tree_); - } -#endif - - _LIBCPP_INLINE_VISIBILITY - void swap(multiset& __s) - _NOEXCEPT_(__is_nothrow_swappable<__base>::value) - {__tree_.swap(__s.__tree_);} - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} - _LIBCPP_INLINE_VISIBILITY - key_compare key_comp() const {return __tree_.value_comp();} - _LIBCPP_INLINE_VISIBILITY - value_compare value_comp() const {return __tree_.value_comp();} - - // set operations: - _LIBCPP_INLINE_VISIBILITY - iterator find(const key_type& __k) {return __tree_.find(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const key_type& __k) const {return __tree_.find(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type - find(const _K2& __k) {return __tree_.find(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type - find(const _K2& __k) const {return __tree_.find(__k);} -#endif - - _LIBCPP_INLINE_VISIBILITY - size_type count(const key_type& __k) const - {return __tree_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) const {return __tree_.__count_multi(__k);} -#endif - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type - contains(const _K2& __k) const { return find(__k) != end(); } -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - iterator lower_bound(const key_type& __k) - {return __tree_.lower_bound(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator lower_bound(const key_type& __k) const - {return __tree_.lower_bound(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type - lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} - - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type - lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} -#endif - - _LIBCPP_INLINE_VISIBILITY - iterator upper_bound(const key_type& __k) - {return __tree_.upper_bound(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator upper_bound(const key_type& __k) const - {return __tree_.upper_bound(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type - upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type - upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} -#endif - - _LIBCPP_INLINE_VISIBILITY - pair<iterator,iterator> equal_range(const key_type& __k) - {return __tree_.__equal_range_multi(__k);} - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator,const_iterator> equal_range(const key_type& __k) const - {return __tree_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 11 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type - equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type - equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} -#endif -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Compare = less<__iter_value_type<_InputIterator>>, - class _Allocator = allocator<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>, - class = enable_if_t<__is_allocator<_Allocator>::value, void>, - class = enable_if_t<!__is_allocator<_Compare>::value, void>> -multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) - -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>; - -template<class _Key, class _Compare = less<_Key>, - class _Allocator = allocator<_Key>, - class = enable_if_t<__is_allocator<_Allocator>::value, void>, - class = enable_if_t<!__is_allocator<_Compare>::value, void>> -multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) - -> multiset<_Key, _Compare, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, void>, - class = enable_if_t<__is_allocator<_Allocator>::value, void>> -multiset(_InputIterator, _InputIterator, _Allocator) - -> multiset<__iter_value_type<_InputIterator>, - less<__iter_value_type<_InputIterator>>, _Allocator>; - -template<class _Key, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value, void>> -multiset(initializer_list<_Key>, _Allocator) - -> multiset<_Key, less<_Key>, _Allocator>; -#endif - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Key, class _Compare, class _Allocator> -multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) - : __tree_(_VSTD::move(__s.__tree_), __a) -{ - if (__a != __s.get_allocator()) - { - const_iterator __e = cend(); - while (!__s.empty()) - insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); - } -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const multiset<_Key, _Compare, _Allocator>& __x, - const multiset<_Key, _Compare, _Allocator>& __y) -{ - return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator< (const multiset<_Key, _Compare, _Allocator>& __x, - const multiset<_Key, _Compare, _Allocator>& __y) -{ - return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const multiset<_Key, _Compare, _Allocator>& __x, - const multiset<_Key, _Compare, _Allocator>& __y) -{ - return !(__x == __y); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator> (const multiset<_Key, _Compare, _Allocator>& __x, - const multiset<_Key, _Compare, _Allocator>& __y) -{ - return __y < __x; -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator>=(const multiset<_Key, _Compare, _Allocator>& __x, - const multiset<_Key, _Compare, _Allocator>& __y) -{ - return !(__x < __y); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<=(const multiset<_Key, _Compare, _Allocator>& __x, - const multiset<_Key, _Compare, _Allocator>& __y) -{ - return !(__y < __x); -} - -template <class _Key, class _Compare, class _Allocator> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(multiset<_Key, _Compare, _Allocator>& __x, - multiset<_Key, _Compare, _Allocator>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Key, class _Compare, class _Allocator, class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename multiset<_Key, _Compare, _Allocator>::size_type - erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { - return _VSTD::__libcpp_erase_if_container(__c, __pred); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_SET diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h b/contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h deleted file mode 100644 index fca41aa31b..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/setjmp.h +++ /dev/null @@ -1,48 +0,0 @@ -// -*- 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_SETJMP_H -#define _LIBCPP_SETJMP_H - -/* - setjmp.h synopsis - -Macros: - - setjmp - -Types: - - jmp_buf - -void longjmp(jmp_buf env, int val); - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#ifdef _LIBCPP_COMPILER_MSVC -#include Y_MSVC_INCLUDE_NEXT(setjmp.h) -#else -#include_next <setjmp.h> -#endif - -#ifdef __cplusplus - -#ifndef setjmp -#define setjmp(env) setjmp(env) -#endif - -#endif // __cplusplus - -#endif // _LIBCPP_SETJMP_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/span b/contrib/libs/cxxsupp/libcxxmsvc/include/span deleted file mode 100644 index 0101dcb822..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/span +++ /dev/null @@ -1,658 +0,0 @@ -// -*- 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_SPAN -#define _LIBCPP_SPAN - -/* - span synopsis - -namespace std { - -// constants -inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); - -// [views.span], class template span -template <class ElementType, size_t Extent = dynamic_extent> - class span; - -template<class ElementType, size_t Extent> - inline constexpr bool ranges::enable_view<span<ElementType, Extent>> = true; - -template<class ElementType, size_t Extent> - inline constexpr bool ranges::enable_borrowed_range<span<ElementType, Extent>> = true; - -// [span.objectrep], views of object representation -template <class ElementType, size_t Extent> - span<const byte, ((Extent == dynamic_extent) ? dynamic_extent : - (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept; - -template <class ElementType, size_t Extent> - span< byte, ((Extent == dynamic_extent) ? dynamic_extent : - (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept; - - -template <class ElementType, size_t Extent = dynamic_extent> -class span { -public: - // constants and types - using element_type = ElementType; - using value_type = remove_cv_t<ElementType>; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = element_type*; - using const_pointer = const element_type*; - using reference = element_type&; - using const_reference = const element_type&; - using iterator = implementation-defined; - using reverse_iterator = std::reverse_iterator<iterator>; - static constexpr size_type extent = Extent; - - // [span.cons], span constructors, copy, assignment, and destructor - constexpr span() noexcept; - template <class It> - constexpr explicit(Extent != dynamic_extent) span(It first, size_type count); - template <class It, class End> - constexpr explicit(Extent != dynamic_extent) span(It first, End last); - template <size_t N> - constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept; - template <size_t N> - constexpr span(array<value_type, N>& arr) noexcept; - template <size_t N> - constexpr span(const array<value_type, N>& arr) noexcept; - template<class R> - constexpr explicit(Extent != dynamic_extent) span(R&& r); - constexpr span(const span& other) noexcept = default; - template <class OtherElementType, size_t OtherExtent> - constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept; - ~span() noexcept = default; - constexpr span& operator=(const span& other) noexcept = default; - - // [span.sub], span subviews - template <size_t Count> - constexpr span<element_type, Count> first() const; - template <size_t Count> - constexpr span<element_type, Count> last() const; - template <size_t Offset, size_t Count = dynamic_extent> - constexpr span<element_type, see below> subspan() const; - - constexpr span<element_type, dynamic_extent> first(size_type count) const; - constexpr span<element_type, dynamic_extent> last(size_type count) const; - constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_extent) const; - - // [span.obs], span observers - constexpr size_type size() const noexcept; - constexpr size_type size_bytes() const noexcept; - [[nodiscard]] constexpr bool empty() const noexcept; - - // [span.elem], span element access - constexpr reference operator[](size_type idx) const; - constexpr reference front() const; - constexpr reference back() const; - constexpr pointer data() const noexcept; - - // [span.iterators], span iterator support - constexpr iterator begin() const noexcept; - constexpr iterator end() const noexcept; - constexpr reverse_iterator rbegin() const noexcept; - constexpr reverse_iterator rend() const noexcept; - -private: - pointer data_; // exposition only - size_type size_; // exposition only -}; - -template<class It, class EndOrSize> - span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; - -template<class T, size_t N> - span(T (&)[N]) -> span<T, N>; - -template<class T, size_t N> - span(array<T, N>&) -> span<T, N>; - -template<class T, size_t N> - span(const array<T, N>&) -> span<const T, N>; - -template<class R> - span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>; - -} // namespace std - -*/ - -#include <__assert> -#include <__config> -#include <__debug> -#include <__iterator/concepts.h> -#include <__iterator/wrap_iter.h> -#include <__ranges/concepts.h> -#include <__ranges/data.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/enable_view.h> -#include <__ranges/size.h> -#include <array> // for array -#include <cstddef> // for byte -#include <iterator> // for iterators -#include <limits> -#include <type_traits> // for remove_cv, etc -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); -template <typename _Tp, size_t _Extent = dynamic_extent> class span; - - -template <class _Tp> -struct __is_std_array : false_type {}; - -template <class _Tp, size_t _Sz> -struct __is_std_array<array<_Tp, _Sz>> : true_type {}; - -template <class _Tp> -struct __is_std_span : false_type {}; - -template <class _Tp, size_t _Sz> -struct __is_std_span<span<_Tp, _Sz>> : true_type {}; - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) -template <class _Range, class _ElementType> -concept __span_compatible_range = - ranges::contiguous_range<_Range> && - ranges::sized_range<_Range> && - (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && - !__is_std_span<remove_cvref_t<_Range>>::value && - !__is_std_array<remove_cvref_t<_Range>>::value && - !is_array_v<remove_cvref_t<_Range>> && - is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; -#else -template <class _Tp, class _ElementType, class = void> -struct __is_span_compatible_container : public false_type {}; - -template <class _Tp, class _ElementType> -struct __is_span_compatible_container<_Tp, _ElementType, - void_t< - // is not a specialization of span - enable_if_t<!__is_std_span<_Tp>::value, nullptr_t>, - // is not a specialization of array - enable_if_t<!__is_std_array<_Tp>::value, nullptr_t>, - // is_array_v<Container> is false, - enable_if_t<!is_array_v<_Tp>, nullptr_t>, - // data(cont) and size(cont) are well formed - decltype(data(declval<_Tp>())), - decltype(size(declval<_Tp>())), - // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to ElementType(*)[] - enable_if_t< - is_convertible_v<remove_pointer_t<decltype(data(declval<_Tp &>()))>(*)[], - _ElementType(*)[]>, - nullptr_t> - >> - : public true_type {}; -#endif - -template <typename _Tp, size_t _Extent> -class _LIBCPP_TEMPLATE_VIS span { -public: -// constants and types - using element_type = _Tp; - using value_type = remove_cv_t<_Tp>; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = _Tp *; - using const_pointer = const _Tp *; - using reference = _Tp &; - using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) - using iterator = pointer; -#else - using iterator = __wrap_iter<pointer>; -#endif - using reverse_iterator = _VSTD::reverse_iterator<iterator>; - - static constexpr size_type extent = _Extent; - -// [span.cons], span constructors, copy, assignment, and destructor - template <size_t _Sz = _Extent, enable_if_t<_Sz == 0, nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {} - - constexpr span (const span&) noexcept = default; - constexpr span& operator=(const span&) noexcept = default; - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) - template <class _It, - enable_if_t<contiguous_iterator<_It> && - is_convertible_v<remove_reference_t<iter_reference_t<_It>>(*)[], element_type (*)[]>, - nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr explicit span(_It __first, size_type __count) - : __data{_VSTD::to_address(__first)} { - (void)__count; - _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)"); - } - - template < - class _It, class _End, - enable_if_t<is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]> && - contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>, - nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr explicit span(_It __first, _End __last) : __data{_VSTD::to_address(__first)} { - (void)__last; - _LIBCPP_ASSERT((__last - __first >= 0), "invalid range in span's constructor (iterator, sentinel)"); - _LIBCPP_ASSERT(__last - __first == _Extent, - "invalid range in span's constructor (iterator, sentinel): last - first != extent"); - } -#else - _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __ptr, size_type __count) : __data{__ptr} - { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); } - _LIBCPP_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l) : __data{__f} - { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); } -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) - - _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {} - - template <class _OtherElementType, - enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} - - template <class _OtherElementType, - enable_if_t<is_convertible_v<const _OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - template <__span_compatible_range<element_type> _Range> - _LIBCPP_INLINE_VISIBILITY - constexpr explicit span(_Range&& __r) : __data{ranges::data(__r)} { - _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); - } -#else - template <class _Container> - _LIBCPP_INLINE_VISIBILITY - constexpr explicit span( _Container& __c, - enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)} { - _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)"); - } - - template <class _Container> - _LIBCPP_INLINE_VISIBILITY - constexpr explicit span(const _Container& __c, - enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)} { - _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (range)"); - } -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - - template <class _OtherElementType> - _LIBCPP_INLINE_VISIBILITY - constexpr span(const span<_OtherElementType, _Extent>& __other, - enable_if_t< - is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, - nullptr_t> = nullptr) - : __data{__other.data()} {} - - template <class _OtherElementType> - _LIBCPP_INLINE_VISIBILITY - constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other, - enable_if_t< - is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, - nullptr_t> = nullptr) noexcept - : __data{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); } - - -// ~span() noexcept = default; - - template <size_t _Count> - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, _Count> first() const noexcept - { - static_assert(_Count <= _Extent, "Count out of range in span::first()"); - return span<element_type, _Count>{data(), _Count}; - } - - template <size_t _Count> - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, _Count> last() const noexcept - { - static_assert(_Count <= _Extent, "Count out of range in span::last()"); - return span<element_type, _Count>{data() + size() - _Count, _Count}; - } - - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept - { - _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); - return {data(), __count}; - } - - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept - { - _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); - return {data() + size() - __count, __count}; - } - - template <size_t _Offset, size_t _Count = dynamic_extent> - _LIBCPP_INLINE_VISIBILITY - constexpr auto subspan() const noexcept - -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> - { - static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()"); - static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "Offset + count out of range in span::subspan()"); - - using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>; - return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; - } - - - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, dynamic_extent> - subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept - { - _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); - _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)"); - if (__count == dynamic_extent) - return {data() + __offset, size() - __offset}; - _LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset, count)"); - return {data() + __offset, __count}; - } - - _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; } - _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); } - [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; } - - _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept - { - _LIBCPP_ASSERT(__idx < size(), "span<T,N>[] index out of bounds"); - return __data[__idx]; - } - - _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept - { - _LIBCPP_ASSERT(!empty(), "span<T, N>::front() on empty span"); - return __data[0]; - } - - _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept - { - _LIBCPP_ASSERT(!empty(), "span<T, N>::back() on empty span"); - return __data[size()-1]; - } - - _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } - -// [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } - _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } - _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } - - _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept - { return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte *>(data()), size_bytes()}; } - - _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept - { return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()}; } - -private: - pointer __data; - -}; - - -template <typename _Tp> -class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> { -private: - -public: -// constants and types - using element_type = _Tp; - using value_type = remove_cv_t<_Tp>; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = _Tp *; - using const_pointer = const _Tp *; - using reference = _Tp &; - using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) - using iterator = pointer; -#else - using iterator = __wrap_iter<pointer>; -#endif - using reverse_iterator = _VSTD::reverse_iterator<iterator>; - - static constexpr size_type extent = dynamic_extent; - -// [span.cons], span constructors, copy, assignment, and destructor - _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {} - - constexpr span (const span&) noexcept = default; - constexpr span& operator=(const span&) noexcept = default; - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) - template <class _It, - enable_if_t<contiguous_iterator<_It> && - is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]>, - nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr span(_It __first, size_type __count) - : __data{_VSTD::to_address(__first)}, __size{__count} {} - - template < - class _It, class _End, - enable_if_t<is_convertible_v<remove_reference_t<iter_reference_t<_It> > (*)[], element_type (*)[]> && - contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>, - nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr span(_It __first, _End __last) - : __data(_VSTD::to_address(__first)), __size(__last - __first) {} -#else - _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {} - _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {} -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) - - template <size_t _Sz> - _LIBCPP_INLINE_VISIBILITY - constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {} - - template <class _OtherElementType, size_t _Sz, - enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} - - template <class _OtherElementType, size_t _Sz, - enable_if_t<is_convertible_v<const _OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr> - _LIBCPP_INLINE_VISIBILITY - constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - template <__span_compatible_range<element_type> _Range> - _LIBCPP_INLINE_VISIBILITY - constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {} -#else - template <class _Container> - _LIBCPP_INLINE_VISIBILITY - constexpr span( _Container& __c, - enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} - - template <class _Container> - _LIBCPP_INLINE_VISIBILITY - constexpr span(const _Container& __c, - enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - - template <class _OtherElementType, size_t _OtherExtent> - _LIBCPP_INLINE_VISIBILITY - constexpr span(const span<_OtherElementType, _OtherExtent>& __other, - enable_if_t< - is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, - nullptr_t> = nullptr) noexcept - : __data{__other.data()}, __size{__other.size()} {} - -// ~span() noexcept = default; - - template <size_t _Count> - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, _Count> first() const noexcept - { - _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()"); - return span<element_type, _Count>{data(), _Count}; - } - - template <size_t _Count> - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, _Count> last() const noexcept - { - _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()"); - return span<element_type, _Count>{data() + size() - _Count, _Count}; - } - - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept - { - _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); - return {data(), __count}; - } - - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept - { - _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); - return {data() + size() - __count, __count}; - } - - template <size_t _Offset, size_t _Count = dynamic_extent> - _LIBCPP_INLINE_VISIBILITY - constexpr span<element_type, _Count> subspan() const noexcept - { - _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()"); - _LIBCPP_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "Offset + count out of range in span::subspan()"); - return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; - } - - constexpr span<element_type, dynamic_extent> - _LIBCPP_INLINE_VISIBILITY - subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept - { - _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); - _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)"); - if (__count == dynamic_extent) - return {data() + __offset, size() - __offset}; - _LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset, count)"); - return {data() + __offset, __count}; - } - - _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; } - _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); } - [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } - - _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept - { - _LIBCPP_ASSERT(__idx < size(), "span<T>[] index out of bounds"); - return __data[__idx]; - } - - _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept - { - _LIBCPP_ASSERT(!empty(), "span<T>[].front() on empty span"); - return __data[0]; - } - - _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept - { - _LIBCPP_ASSERT(!empty(), "span<T>[].back() on empty span"); - return __data[size()-1]; - } - - - _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } - -// [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } - _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } - _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } - - inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept; - - inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept; - -private: - pointer __data; - size_type __size; -}; - -template<typename _Tp> -inline _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_bytes() const noexcept -{ return {reinterpret_cast<const byte *>(data()), size_bytes()}; } - -template<typename _Tp> -inline _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> span<_Tp, dynamic_extent>::__as_writable_bytes() const noexcept -{ return {reinterpret_cast<byte *>(data()), size_bytes()}; } - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) -template <class _Tp, size_t _Extent> -inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true; - -template <class _ElementType, size_t _Extent> -inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true; -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) - -// as_bytes & as_writable_bytes -template <class _Tp, size_t _Extent> -_LIBCPP_INLINE_VISIBILITY -auto as_bytes(span<_Tp, _Extent> __s) noexcept --> decltype(__s.__as_bytes()) -{ return __s.__as_bytes(); } - -template <class _Tp, size_t _Extent> -_LIBCPP_INLINE_VISIBILITY -auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept --> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())> -{ return __s.__as_writable_bytes(); } - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) -template<contiguous_iterator _It, class _EndOrSize> - span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; -#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) - -template<class _Tp, size_t _Sz> - span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>; - -template<class _Tp, size_t _Sz> - span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>; - -template<class _Tp, size_t _Sz> - span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>; - -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) -template<ranges::contiguous_range _Range> - span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>; -#endif - -#endif // _LIBCPP_STD_VER > 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_SPAN diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h b/contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h deleted file mode 100644 index d9550c4406..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/stdatomic.h +++ /dev/null @@ -1,235 +0,0 @@ -// -*- 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_STDATOMIC_H -#define _LIBCPP_STDATOMIC_H - -/* - stdatomic.h synopsis - -template<class T> - using std-atomic = std::atomic<T>; // exposition only - -#define _Atomic(T) std-atomic<T> - -#define ATOMIC_BOOL_LOCK_FREE see below -#define ATOMIC_CHAR_LOCK_FREE see below -#define ATOMIC_CHAR16_T_LOCK_FREE see below -#define ATOMIC_CHAR32_T_LOCK_FREE see below -#define ATOMIC_WCHAR_T_LOCK_FREE see below -#define ATOMIC_SHORT_LOCK_FREE see below -#define ATOMIC_INT_LOCK_FREE see below -#define ATOMIC_LONG_LOCK_FREE see below -#define ATOMIC_LLONG_LOCK_FREE see below -#define ATOMIC_POINTER_LOCK_FREE see below - -using std::memory_order // see below -using std::memory_order_relaxed // see below -using std::memory_order_consume // see below -using std::memory_order_acquire // see below -using std::memory_order_release // see below -using std::memory_order_acq_rel // see below -using std::memory_order_seq_cst // see below - -using std::atomic_flag // see below - -using std::atomic_bool // see below -using std::atomic_char // see below -using std::atomic_schar // see below -using std::atomic_uchar // see below -using std::atomic_short // see below -using std::atomic_ushort // see below -using std::atomic_int // see below -using std::atomic_uint // see below -using std::atomic_long // see below -using std::atomic_ulong // see below -using std::atomic_llong // see below -using std::atomic_ullong // see below -using std::atomic_char8_t // see below -using std::atomic_char16_t // see below -using std::atomic_char32_t // see below -using std::atomic_wchar_t // see below -using std::atomic_int8_t // see below -using std::atomic_uint8_t // see below -using std::atomic_int16_t // see below -using std::atomic_uint16_t // see below -using std::atomic_int32_t // see below -using std::atomic_uint32_t // see below -using std::atomic_int64_t // see below -using std::atomic_uint64_t // see below -using std::atomic_int_least8_t // see below -using std::atomic_uint_least8_t // see below -using std::atomic_int_least16_t // see below -using std::atomic_uint_least16_t // see below -using std::atomic_int_least32_t // see below -using std::atomic_uint_least32_t // see below -using std::atomic_int_least64_t // see below -using std::atomic_uint_least64_t // see below -using std::atomic_int_fast8_t // see below -using std::atomic_uint_fast8_t // see below -using std::atomic_int_fast16_t // see below -using std::atomic_uint_fast16_t // see below -using std::atomic_int_fast32_t // see below -using std::atomic_uint_fast32_t // see below -using std::atomic_int_fast64_t // see below -using std::atomic_uint_fast64_t // see below -using std::atomic_intptr_t // see below -using std::atomic_uintptr_t // see below -using std::atomic_size_t // see below -using std::atomic_ptrdiff_t // see below -using std::atomic_intmax_t // see below -using std::atomic_uintmax_t // see below - -using std::atomic_is_lock_free // see below -using std::atomic_load // see below -using std::atomic_load_explicit // see below -using std::atomic_store // see below -using std::atomic_store_explicit // see below -using std::atomic_exchange // see below -using std::atomic_exchange_explicit // see below -using std::atomic_compare_exchange_strong // see below -using std::atomic_compare_exchange_strong_explicit // see below -using std::atomic_compare_exchange_weak // see below -using std::atomic_compare_exchange_weak_explicit // see below -using std::atomic_fetch_add // see below -using std::atomic_fetch_add_explicit // see below -using std::atomic_fetch_sub // see below -using std::atomic_fetch_sub_explicit // see below -using std::atomic_fetch_or // see below -using std::atomic_fetch_or_explicit // see below -using std::atomic_fetch_and // see below -using std::atomic_fetch_and_explicit // see below -using std::atomic_flag_test_and_set // see below -using std::atomic_flag_test_and_set_explicit // see below -using std::atomic_flag_clear // see below -using std::atomic_flag_clear_explicit // see below - -using std::atomic_thread_fence // see below -using std::atomic_signal_fence // see below - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#if _LIBCPP_STD_VER > 20 - -#include <atomic> -#include <version> - -#ifdef _Atomic -# undef _Atomic -#endif - -#define _Atomic(_Tp) ::std::atomic<_Tp> - -using std::memory_order _LIBCPP_USING_IF_EXISTS; -using std::memory_order_relaxed _LIBCPP_USING_IF_EXISTS; -using std::memory_order_consume _LIBCPP_USING_IF_EXISTS; -using std::memory_order_acquire _LIBCPP_USING_IF_EXISTS; -using std::memory_order_release _LIBCPP_USING_IF_EXISTS; -using std::memory_order_acq_rel _LIBCPP_USING_IF_EXISTS; -using std::memory_order_seq_cst _LIBCPP_USING_IF_EXISTS; - -using std::atomic_flag _LIBCPP_USING_IF_EXISTS; - -using std::atomic_bool _LIBCPP_USING_IF_EXISTS; -using std::atomic_char _LIBCPP_USING_IF_EXISTS; -using std::atomic_schar _LIBCPP_USING_IF_EXISTS; -using std::atomic_uchar _LIBCPP_USING_IF_EXISTS; -using std::atomic_short _LIBCPP_USING_IF_EXISTS; -using std::atomic_ushort _LIBCPP_USING_IF_EXISTS; -using std::atomic_int _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint _LIBCPP_USING_IF_EXISTS; -using std::atomic_long _LIBCPP_USING_IF_EXISTS; -using std::atomic_ulong _LIBCPP_USING_IF_EXISTS; -using std::atomic_llong _LIBCPP_USING_IF_EXISTS; -using std::atomic_ullong _LIBCPP_USING_IF_EXISTS; -using std::atomic_char8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_char16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_char32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_wchar_t _LIBCPP_USING_IF_EXISTS; - -using std::atomic_int8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int64_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint64_t _LIBCPP_USING_IF_EXISTS; - -using std::atomic_int_least8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_least8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int_least16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_least16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int_least32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_least32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int_least64_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_least64_t _LIBCPP_USING_IF_EXISTS; - -using std::atomic_int_fast8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_fast8_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int_fast16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_fast16_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int_fast32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_fast32_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_int_fast64_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uint_fast64_t _LIBCPP_USING_IF_EXISTS; - -using std::atomic_intptr_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uintptr_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_size_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_ptrdiff_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_intmax_t _LIBCPP_USING_IF_EXISTS; -using std::atomic_uintmax_t _LIBCPP_USING_IF_EXISTS; - -using std::atomic_compare_exchange_strong _LIBCPP_USING_IF_EXISTS; -using std::atomic_compare_exchange_strong_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_compare_exchange_weak _LIBCPP_USING_IF_EXISTS; -using std::atomic_compare_exchange_weak_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_exchange _LIBCPP_USING_IF_EXISTS; -using std::atomic_exchange_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_add _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_add_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_and _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_and_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_or _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_or_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_sub _LIBCPP_USING_IF_EXISTS; -using std::atomic_fetch_sub_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_flag_clear _LIBCPP_USING_IF_EXISTS; -using std::atomic_flag_clear_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_flag_test_and_set _LIBCPP_USING_IF_EXISTS; -using std::atomic_flag_test_and_set_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_is_lock_free _LIBCPP_USING_IF_EXISTS; -using std::atomic_load _LIBCPP_USING_IF_EXISTS; -using std::atomic_load_explicit _LIBCPP_USING_IF_EXISTS; -using std::atomic_store _LIBCPP_USING_IF_EXISTS; -using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS; - -using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS; -using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; - -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) - -// Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking -// the header. We do this because Clang has historically shipped a <stdatomic.h> -// header that would be available in all Standard modes, and we don't want to -// break that use case. -# if __has_include_next(<stdatomic.h>) -# include_next <stdatomic.h> -# endif - -#endif // _LIBCPP_STD_VER > 20 - -#endif // _LIBCPP_STDATOMIC_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h b/contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h deleted file mode 100644 index c596f2441c..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/stdbool.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- 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_STDBOOL_H -#define _LIBCPP_STDBOOL_H - - -/* - stdbool.h synopsis - -Macros: - - __bool_true_false_are_defined - -*/ - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#ifdef _LIBCPP_COMPILER_MSVC -#include Y_MSVC_INCLUDE_NEXT(stdbool.h) -#else -#include_next <stdbool.h> -#endif - -#ifdef __cplusplus -#undef bool -#undef true -#undef false -#undef __bool_true_false_are_defined -#define __bool_true_false_are_defined 1 -#endif - -#endif // _LIBCPP_STDBOOL_H diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd b/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd index adad6790dc..235ae7f0e2 100644 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd +++ b/contrib/libs/cxxsupp/libcxxmsvc/include/stlfwd @@ -61,3 +61,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD +_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM + + class path; + +_LIBCPP_END_NAMESPACE_FILESYSTEM diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/typeindex b/contrib/libs/cxxsupp/libcxxmsvc/include/typeindex deleted file mode 100644 index b5dcd8496a..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/typeindex +++ /dev/null @@ -1,115 +0,0 @@ -// -*- 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_TYPEINDEX -#define _LIBCPP_TYPEINDEX - -/* - - typeindex synopsis - -namespace std -{ - -class type_index -{ -public: - type_index(const type_info& rhs) noexcept; - - bool operator==(const type_index& rhs) const noexcept; - bool operator!=(const type_index& rhs) const noexcept; - bool operator< (const type_index& rhs) const noexcept; - bool operator<=(const type_index& rhs) const noexcept; - bool operator> (const type_index& rhs) const noexcept; - bool operator>=(const type_index& rhs) const noexcept; - - size_t hash_code() const noexcept; - const char* name() const noexcept; -}; - -template <> -struct hash<type_index> - : public unary_function<type_index, size_t> -{ - size_t operator()(type_index index) const noexcept; -}; - -} // std - -*/ - -#include <__config> -#include <__functional/unary_function.h> -#include <compare> -#include <typeinfo> -#include <version> - -// TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/weak_result_type.h> -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <new> -#include <utility> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -class _LIBCPP_TEMPLATE_VIS type_index -{ - const type_info* __t_; -public: - _LIBCPP_INLINE_VISIBILITY - type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {} - - _LIBCPP_INLINE_VISIBILITY - bool operator==(const type_index& __y) const _NOEXCEPT - {return *__t_ == *__y.__t_;} - _LIBCPP_INLINE_VISIBILITY - bool operator!=(const type_index& __y) const _NOEXCEPT - {return *__t_ != *__y.__t_;} - _LIBCPP_INLINE_VISIBILITY - bool operator< (const type_index& __y) const _NOEXCEPT - {return __t_->before(*__y.__t_);} - _LIBCPP_INLINE_VISIBILITY - bool operator<=(const type_index& __y) const _NOEXCEPT - {return !__y.__t_->before(*__t_);} - _LIBCPP_INLINE_VISIBILITY - bool operator> (const type_index& __y) const _NOEXCEPT - {return __y.__t_->before(*__t_);} - _LIBCPP_INLINE_VISIBILITY - bool operator>=(const type_index& __y) const _NOEXCEPT - {return !__t_->before(*__y.__t_);} - - _LIBCPP_INLINE_VISIBILITY - size_t hash_code() const _NOEXCEPT {return __t_->hash_code();} - _LIBCPP_INLINE_VISIBILITY - const char* name() const _NOEXCEPT {return __t_->name();} -}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash; - -template <> -struct _LIBCPP_TEMPLATE_VIS hash<type_index> - : public unary_function<type_index, size_t> -{ - _LIBCPP_INLINE_VISIBILITY - size_t operator()(type_index __index) const _NOEXCEPT - {return __index.hash_code();} -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_TYPEINDEX diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map b/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map deleted file mode 100644 index c854548950..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_map +++ /dev/null @@ -1,2619 +0,0 @@ -// -*- 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_UNORDERED_MAP -#define _LIBCPP_UNORDERED_MAP - -/* - - unordered_map synopsis - -#include <initializer_list> - -namespace std -{ - -template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, - class Alloc = allocator<pair<const Key, T>>> -class unordered_map -{ -public: - // types - typedef Key key_type; - typedef T mapped_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef pair<const key_type, mapped_type> value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - typedef unspecified node_type; // C++17 - typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 - - unordered_map() - noexcept( - is_nothrow_default_constructible<hasher>::value && - is_nothrow_default_constructible<key_equal>::value && - is_nothrow_default_constructible<allocator_type>::value); - explicit unordered_map(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template <class InputIterator> - unordered_map(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit unordered_map(const allocator_type&); - unordered_map(const unordered_map&); - unordered_map(const unordered_map&, const Allocator&); - unordered_map(unordered_map&&) - noexcept( - is_nothrow_move_constructible<hasher>::value && - is_nothrow_move_constructible<key_equal>::value && - is_nothrow_move_constructible<allocator_type>::value); - unordered_map(unordered_map&&, const Allocator&); - unordered_map(initializer_list<value_type>, size_type n = 0, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - unordered_map(size_type n, const allocator_type& a) - : unordered_map(n, hasher(), key_equal(), a) {} // C++14 - unordered_map(size_type n, const hasher& hf, const allocator_type& a) - : unordered_map(n, hf, key_equal(), a) {} // C++14 - template <class InputIterator> - unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a) - : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14 - template <class InputIterator> - unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf, - const allocator_type& a) - : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14 - unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a) - : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14 - unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf, - const allocator_type& a) - : unordered_map(il, n, hf, key_equal(), a) {} // C++14 - ~unordered_map(); - unordered_map& operator=(const unordered_map&); - unordered_map& operator=(unordered_map&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<hasher>::value && - is_nothrow_move_assignable<key_equal>::value); - unordered_map& operator=(initializer_list<value_type>); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template <class... Args> - pair<iterator, bool> emplace(Args&&... args); - template <class... Args> - iterator emplace_hint(const_iterator position, Args&&... args); - pair<iterator, bool> insert(const value_type& obj); - template <class P> - pair<iterator, bool> insert(P&& obj); - iterator insert(const_iterator hint, const value_type& obj); - template <class P> - iterator insert(const_iterator hint, P&& obj); - template <class InputIterator> - void insert(InputIterator first, InputIterator last); - void insert(initializer_list<value_type>); - - node_type extract(const_iterator position); // C++17 - node_type extract(const key_type& x); // C++17 - insert_return_type insert(node_type&& nh); // C++17 - iterator insert(const_iterator hint, node_type&& nh); // C++17 - - template <class... Args> - pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17 - template <class... Args> - pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17 - template <class... Args> - iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 - template <class... Args> - iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 - template <class M> - pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17 - template <class M> - pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17 - template <class M> - iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 - template <class M> - iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 - - iterator erase(const_iterator position); - iterator erase(iterator position); // C++14 - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - template<class H2, class P2> - void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17 - template<class H2, class P2> - void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17 - - void swap(unordered_map&) - noexcept( - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable<allocator_type>::value) && - __is_nothrow_swappable<hasher>::value && - __is_nothrow_swappable<key_equal>::value); - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - template<typename K> - iterator find(const K& x); // C++20 - template<typename K> - const_iterator find(const K& x) const; // C++20 - size_type count(const key_type& k) const; - template<typename K> - size_type count(const K& k) const; // C++20 - bool contains(const key_type& k) const; // C++20 - template<typename K> - bool contains(const K& k) const; // C++20 - pair<iterator, iterator> equal_range(const key_type& k); - pair<const_iterator, const_iterator> equal_range(const key_type& k) const; - template<typename K> - pair<iterator, iterator> equal_range(const K& k); // C++20 - template<typename K> - pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 - - mapped_type& operator[](const key_type& k); - mapped_type& operator[](key_type&& k); - - mapped_type& at(const key_type& k); - const mapped_type& at(const key_type& k) const; - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; - -template<class InputIterator, - class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>, - class Allocator = allocator<iter_to_alloc_t<InputIterator>>> -unordered_map(InputIterator, InputIterator, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_map<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred, - Allocator>; // C++17 - -template<class Key, class T, class Hash = hash<Key>, - class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>> -unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_map<Key, T, Hash, Pred, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -unordered_map(InputIterator, InputIterator, typename see below::size_type, Allocator) - -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, - hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -unordered_map(InputIterator, InputIterator, Allocator) - -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, - hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 - -template<class InputIterator, class Hash, class Allocator> -unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator) - -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash, - equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 - -template<class Key, class T, typename Allocator> -unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator) - -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 - -template<class Key, class T, typename Allocator> -unordered_map(initializer_list<pair<const Key, T>>, Allocator) - -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 - -template<class Key, class T, class Hash, class Allocator> -unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash, Allocator) - -> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>; // C++17 - -template <class Key, class T, class Hash, class Pred, class Alloc> - void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x, - unordered_map<Key, T, Hash, Pred, Alloc>& y) - noexcept(noexcept(x.swap(y))); - -template <class Key, class T, class Hash, class Pred, class Alloc> - bool - operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& x, - const unordered_map<Key, T, Hash, Pred, Alloc>& y); - -template <class Key, class T, class Hash, class Pred, class Alloc> - bool - operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& x, - const unordered_map<Key, T, Hash, Pred, Alloc>& y); - -template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, - class Alloc = allocator<pair<const Key, T>>> -class unordered_multimap -{ -public: - // types - typedef Key key_type; - typedef T mapped_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef pair<const key_type, mapped_type> value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - typedef unspecified node_type; // C++17 - - unordered_multimap() - noexcept( - is_nothrow_default_constructible<hasher>::value && - is_nothrow_default_constructible<key_equal>::value && - is_nothrow_default_constructible<allocator_type>::value); - explicit unordered_multimap(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template <class InputIterator> - unordered_multimap(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit unordered_multimap(const allocator_type&); - unordered_multimap(const unordered_multimap&); - unordered_multimap(const unordered_multimap&, const Allocator&); - unordered_multimap(unordered_multimap&&) - noexcept( - is_nothrow_move_constructible<hasher>::value && - is_nothrow_move_constructible<key_equal>::value && - is_nothrow_move_constructible<allocator_type>::value); - unordered_multimap(unordered_multimap&&, const Allocator&); - unordered_multimap(initializer_list<value_type>, size_type n = 0, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - unordered_multimap(size_type n, const allocator_type& a) - : unordered_multimap(n, hasher(), key_equal(), a) {} // C++14 - unordered_multimap(size_type n, const hasher& hf, const allocator_type& a) - : unordered_multimap(n, hf, key_equal(), a) {} // C++14 - template <class InputIterator> - unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a) - : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14 - template <class InputIterator> - unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf, - const allocator_type& a) - : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14 - unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a) - : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14 - unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf, - const allocator_type& a) - : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14 - ~unordered_multimap(); - unordered_multimap& operator=(const unordered_multimap&); - unordered_multimap& operator=(unordered_multimap&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<hasher>::value && - is_nothrow_move_assignable<key_equal>::value); - unordered_multimap& operator=(initializer_list<value_type>); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template <class... Args> - iterator emplace(Args&&... args); - template <class... Args> - iterator emplace_hint(const_iterator position, Args&&... args); - iterator insert(const value_type& obj); - template <class P> - iterator insert(P&& obj); - iterator insert(const_iterator hint, const value_type& obj); - template <class P> - iterator insert(const_iterator hint, P&& obj); - template <class InputIterator> - void insert(InputIterator first, InputIterator last); - void insert(initializer_list<value_type>); - - node_type extract(const_iterator position); // C++17 - node_type extract(const key_type& x); // C++17 - iterator insert(node_type&& nh); // C++17 - iterator insert(const_iterator hint, node_type&& nh); // C++17 - - iterator erase(const_iterator position); - iterator erase(iterator position); // C++14 - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - template<class H2, class P2> - void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17 - template<class H2, class P2> - void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17 - - void swap(unordered_multimap&) - noexcept( - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable<allocator_type>::value) && - __is_nothrow_swappable<hasher>::value && - __is_nothrow_swappable<key_equal>::value); - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - template<typename K> - iterator find(const K& x); // C++20 - template<typename K> - const_iterator find(const K& x) const; // C++20 - size_type count(const key_type& k) const; - template<typename K> - size_type count(const K& k) const; // C++20 - bool contains(const key_type& k) const; // C++20 - template<typename K> - bool contains(const K& k) const; // C++20 - pair<iterator, iterator> equal_range(const key_type& k); - pair<const_iterator, const_iterator> equal_range(const key_type& k) const; - template<typename K> - pair<iterator, iterator> equal_range(const K& k); // C++20 - template<typename K> - pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; - -template<class InputIterator, - class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>, - class Allocator = allocator<iter_to_alloc_t<InputIterator>>> -unordered_multimap(InputIterator, InputIterator, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_multimap<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred, - Allocator>; // C++17 - -template<class Key, class T, class Hash = hash<Key>, - class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>> -unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_multimap<Key, T, Hash, Pred, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Allocator) - -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, - hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -unordered_multimap(InputIterator, InputIterator, Allocator) - -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, - hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 - -template<class InputIterator, class Hash, class Allocator> -unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator) - -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash, - equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 - -template<class Key, class T, typename Allocator> -unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator) - -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 - -template<class Key, class T, typename Allocator> -unordered_multimap(initializer_list<pair<const Key, T>>, Allocator) - -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 - -template<class Key, class T, class Hash, class Allocator> -unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash, - Allocator) - -> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>; // C++17 - -template <class Key, class T, class Hash, class Pred, class Alloc> - void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x, - unordered_multimap<Key, T, Hash, Pred, Alloc>& y) - noexcept(noexcept(x.swap(y))); - -template <class K, class T, class H, class P, class A, class Predicate> - typename unordered_map<K, T, H, P, A>::size_type - erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred); // C++20 - -template <class K, class T, class H, class P, class A, class Predicate> - typename unordered_multimap<K, T, H, P, A>::size_type - erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred); // C++20 - -template <class Key, class T, class Hash, class Pred, class Alloc> - bool - operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x, - const unordered_multimap<Key, T, Hash, Pred, Alloc>& y); - -template <class Key, class T, class Hash, class Pred, class Alloc> - bool - operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x, - const unordered_multimap<Key, T, Hash, Pred, Alloc>& y); - -} // std - -*/ - -#include <__algorithm/is_permutation.h> -#include <__assert> -#include <__config> -#include <__debug> -#include <__functional/is_transparent.h> -#include <__hash_table> -#include <__iterator/iterator_traits.h> -#include <__memory/addressof.h> -#include <__node_handle> -#include <__utility/forward.h> -#include <compare> -#include <functional> -#include <iterator> // __libcpp_erase_if_container -#include <stdexcept> -#include <tuple> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Key, class _Cp, class _Hash, class _Pred, - bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value> -class __unordered_map_hasher - : private _Hash -{ -public: - _LIBCPP_INLINE_VISIBILITY - __unordered_map_hasher() - _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) - : _Hash() {} - _LIBCPP_INLINE_VISIBILITY - __unordered_map_hasher(const _Hash& __h) - _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value) - : _Hash(__h) {} - _LIBCPP_INLINE_VISIBILITY - const _Hash& hash_function() const _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _Cp& __x) const - {return static_cast<const _Hash&>(*this)(__x.__get_value().first);} - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _Key& __x) const - {return static_cast<const _Hash&>(*this)(__x);} -#if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _K2& __x) const - {return static_cast<const _Hash&>(*this)(__x);} -#endif - _LIBCPP_INLINE_VISIBILITY - void swap(__unordered_map_hasher& __y) - _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) - { - using _VSTD::swap; - swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y)); - } -}; - -template <class _Key, class _Cp, class _Hash, class _Pred> -class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false> -{ - _Hash __hash_; -public: - _LIBCPP_INLINE_VISIBILITY - __unordered_map_hasher() - _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) - : __hash_() {} - _LIBCPP_INLINE_VISIBILITY - __unordered_map_hasher(const _Hash& __h) - _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value) - : __hash_(__h) {} - _LIBCPP_INLINE_VISIBILITY - const _Hash& hash_function() const _NOEXCEPT {return __hash_;} - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _Cp& __x) const - {return __hash_(__x.__get_value().first);} - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _Key& __x) const - {return __hash_(__x);} -#if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _K2& __x) const - {return __hash_(__x);} -#endif - _LIBCPP_INLINE_VISIBILITY - void swap(__unordered_map_hasher& __y) - _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) - { - using _VSTD::swap; - swap(__hash_, __y.__hash_); - } -}; - -template <class _Key, class _Cp, class _Hash, class _Pred, bool __b> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x, - __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -template <class _Key, class _Cp, class _Pred, class _Hash, - bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value> -class __unordered_map_equal - : private _Pred -{ -public: - _LIBCPP_INLINE_VISIBILITY - __unordered_map_equal() - _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) - : _Pred() {} - _LIBCPP_INLINE_VISIBILITY - __unordered_map_equal(const _Pred& __p) - _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value) - : _Pred(__p) {} - _LIBCPP_INLINE_VISIBILITY - const _Pred& key_eq() const _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Cp& __x, const _Cp& __y) const - {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);} - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Cp& __x, const _Key& __y) const - {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);} - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Key& __x, const _Cp& __y) const - {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} -#if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Cp& __x, const _K2& __y) const - {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _K2& __x, const _Cp& __y) const - {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Key& __x, const _K2& __y) const - {return static_cast<const _Pred&>(*this)(__x, __y);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _K2& __x, const _Key& __y) const - {return static_cast<const _Pred&>(*this)(__x, __y);} -#endif - _LIBCPP_INLINE_VISIBILITY - void swap(__unordered_map_equal& __y) - _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) - { - using _VSTD::swap; - swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y)); - } -}; - -template <class _Key, class _Cp, class _Pred, class _Hash> -class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false> -{ - _Pred __pred_; -public: - _LIBCPP_INLINE_VISIBILITY - __unordered_map_equal() - _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) - : __pred_() {} - _LIBCPP_INLINE_VISIBILITY - __unordered_map_equal(const _Pred& __p) - _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value) - : __pred_(__p) {} - _LIBCPP_INLINE_VISIBILITY - const _Pred& key_eq() const _NOEXCEPT {return __pred_;} - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Cp& __x, const _Cp& __y) const - {return __pred_(__x.__get_value().first, __y.__get_value().first);} - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Cp& __x, const _Key& __y) const - {return __pred_(__x.__get_value().first, __y);} - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Key& __x, const _Cp& __y) const - {return __pred_(__x, __y.__get_value().first);} -#if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Cp& __x, const _K2& __y) const - {return __pred_(__x.__get_value().first, __y);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _K2& __x, const _Cp& __y) const - {return __pred_(__x, __y.__get_value().first);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Key& __x, const _K2& __y) const - {return __pred_(__x, __y);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - bool operator()(const _K2& __x, const _Key& __y) const - {return __pred_(__x, __y);} -#endif - _LIBCPP_INLINE_VISIBILITY - void swap(__unordered_map_equal& __y) - _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) - { - using _VSTD::swap; - swap(__pred_, __y.__pred_); - } -}; - -template <class _Key, class _Cp, class _Pred, class _Hash, bool __b> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x, - __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -template <class _Alloc> -class __hash_map_node_destructor -{ - typedef _Alloc allocator_type; - typedef allocator_traits<allocator_type> __alloc_traits; - -public: - - typedef typename __alloc_traits::pointer pointer; -private: - - allocator_type& __na_; - - __hash_map_node_destructor& operator=(const __hash_map_node_destructor&); - -public: - bool __first_constructed; - bool __second_constructed; - - _LIBCPP_INLINE_VISIBILITY - explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT - : __na_(__na), - __first_constructed(false), - __second_constructed(false) - {} - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) - _NOEXCEPT - : __na_(__x.__na_), - __first_constructed(__x.__value_constructed), - __second_constructed(__x.__value_constructed) - { - __x.__value_constructed = false; - } -#else // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x) - : __na_(__x.__na_), - __first_constructed(__x.__value_constructed), - __second_constructed(__x.__value_constructed) - { - const_cast<bool&>(__x.__value_constructed) = false; - } -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - void operator()(pointer __p) _NOEXCEPT - { - if (__second_constructed) - __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().second)); - if (__first_constructed) - __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().first)); - if (__p) - __alloc_traits::deallocate(__na_, __p, 1); - } -}; - -#ifndef _LIBCPP_CXX03_LANG -template <class _Key, class _Tp> -struct _LIBCPP_STANDALONE_DEBUG __hash_value_type -{ - typedef _Key key_type; - typedef _Tp mapped_type; - typedef pair<const key_type, mapped_type> value_type; - typedef pair<key_type&, mapped_type&> __nc_ref_pair_type; - typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; - -private: - value_type __cc; - -public: - _LIBCPP_INLINE_VISIBILITY - value_type& __get_value() - { -#if _LIBCPP_STD_VER > 14 - return *_VSTD::launder(_VSTD::addressof(__cc)); -#else - return __cc; -#endif - } - - _LIBCPP_INLINE_VISIBILITY - const value_type& __get_value() const - { -#if _LIBCPP_STD_VER > 14 - return *_VSTD::launder(_VSTD::addressof(__cc)); -#else - return __cc; -#endif - } - - _LIBCPP_INLINE_VISIBILITY - __nc_ref_pair_type __ref() - { - value_type& __v = __get_value(); - return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second); - } - - _LIBCPP_INLINE_VISIBILITY - __nc_rref_pair_type __move() - { - value_type& __v = __get_value(); - return __nc_rref_pair_type( - _VSTD::move(const_cast<key_type&>(__v.first)), - _VSTD::move(__v.second)); - } - - _LIBCPP_INLINE_VISIBILITY - __hash_value_type& operator=(const __hash_value_type& __v) - { - __ref() = __v.__get_value(); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - __hash_value_type& operator=(__hash_value_type&& __v) - { - __ref() = __v.__move(); - return *this; - } - - template <class _ValueTp, - class = typename enable_if< - __is_same_uncvref<_ValueTp, value_type>::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - __hash_value_type& operator=(_ValueTp&& __v) - { - __ref() = _VSTD::forward<_ValueTp>(__v); - return *this; - } - -private: - __hash_value_type(const __hash_value_type& __v) = delete; - __hash_value_type(__hash_value_type&& __v) = delete; - template <class ..._Args> - explicit __hash_value_type(_Args&& ...__args) = delete; - - ~__hash_value_type() = delete; -}; - -#else - -template <class _Key, class _Tp> -struct __hash_value_type -{ - typedef _Key key_type; - typedef _Tp mapped_type; - typedef pair<const key_type, mapped_type> value_type; - -private: - value_type __cc; - -public: - _LIBCPP_INLINE_VISIBILITY - value_type& __get_value() { return __cc; } - _LIBCPP_INLINE_VISIBILITY - const value_type& __get_value() const { return __cc; } - -private: - ~__hash_value_type(); -}; - -#endif - -template <class _HashIterator> -class _LIBCPP_TEMPLATE_VIS __hash_map_iterator -{ - _HashIterator __i_; - - typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes; - -public: - typedef forward_iterator_tag iterator_category; - typedef typename _NodeTypes::__map_value_type value_type; - typedef typename _NodeTypes::difference_type difference_type; - typedef value_type& reference; - typedef typename _NodeTypes::__map_value_type_pointer pointer; - - _LIBCPP_INLINE_VISIBILITY - __hash_map_iterator() _NOEXCEPT {} - - _LIBCPP_INLINE_VISIBILITY - __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {} - - _LIBCPP_INLINE_VISIBILITY - reference operator*() const {return __i_->__get_value();} - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} - - _LIBCPP_INLINE_VISIBILITY - __hash_map_iterator& operator++() {++__i_; return *this;} - _LIBCPP_INLINE_VISIBILITY - __hash_map_iterator operator++(int) - { - __hash_map_iterator __t(*this); - ++(*this); - return __t; - } - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) - {return __x.__i_ == __y.__i_;} - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) - {return __x.__i_ != __y.__i_;} - - template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map; - template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; - template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator; - template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator; - template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator; -}; - -template <class _HashIterator> -class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator -{ - _HashIterator __i_; - - typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes; - -public: - typedef forward_iterator_tag iterator_category; - typedef typename _NodeTypes::__map_value_type value_type; - typedef typename _NodeTypes::difference_type difference_type; - typedef const value_type& reference; - typedef typename _NodeTypes::__const_map_value_type_pointer pointer; - - _LIBCPP_INLINE_VISIBILITY - __hash_map_const_iterator() _NOEXCEPT {} - - _LIBCPP_INLINE_VISIBILITY - __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {} - _LIBCPP_INLINE_VISIBILITY - __hash_map_const_iterator( - __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i) - _NOEXCEPT - : __i_(__i.__i_) {} - - _LIBCPP_INLINE_VISIBILITY - reference operator*() const {return __i_->__get_value();} - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} - - _LIBCPP_INLINE_VISIBILITY - __hash_map_const_iterator& operator++() {++__i_; return *this;} - _LIBCPP_INLINE_VISIBILITY - __hash_map_const_iterator operator++(int) - { - __hash_map_const_iterator __t(*this); - ++(*this); - return __t; - } - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) - {return __x.__i_ == __y.__i_;} - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) - {return __x.__i_ != __y.__i_;} - - template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map; - template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; - template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator; - template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator; -}; - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -class unordered_multimap; - -template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, - class _Alloc = allocator<pair<const _Key, _Tp> > > -class _LIBCPP_TEMPLATE_VIS unordered_map -{ -public: - // types - typedef _Key key_type; - typedef _Tp mapped_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; - typedef pair<const key_type, mapped_type> value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); - -private: - typedef __hash_value_type<key_type, mapped_type> __value_type; - typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; - typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; - typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, - __value_type>::type __allocator_type; - - typedef __hash_table<__value_type, __hasher, - __key_equal, __allocator_type> __table; - - __table __table_; - - typedef typename __table::_NodeTypes _NodeTypes; - typedef typename __table::__node_pointer __node_pointer; - typedef typename __table::__node_const_pointer __node_const_pointer; - typedef typename __table::__node_traits __node_traits; - typedef typename __table::__node_allocator __node_allocator; - typedef typename __table::__node __node; - typedef __hash_map_node_destructor<__node_allocator> _Dp; - typedef unique_ptr<__node, _Dp> __node_holder; - typedef allocator_traits<allocator_type> __alloc_traits; - - static_assert((is_same<typename __table::__container_value_type, value_type>::value), ""); - static_assert((is_same<typename __table::__node_value_type, __value_type>::value), ""); -public: - typedef typename __alloc_traits::pointer pointer; - typedef typename __alloc_traits::const_pointer const_pointer; - typedef typename __table::size_type size_type; - typedef typename __table::difference_type difference_type; - - typedef __hash_map_iterator<typename __table::iterator> iterator; - typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; - typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; - typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; - -#if _LIBCPP_STD_VER > 14 - typedef __map_node_handle<__node, allocator_type> node_type; - typedef __insert_return_type<iterator, node_type> insert_return_type; -#endif - - template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_map; - template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; - - _LIBCPP_INLINE_VISIBILITY - unordered_map() - _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { - _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, - const key_equal& __eql, - const allocator_type& __a); - template <class _InputIterator> - unordered_map(_InputIterator __first, _InputIterator __last); - template <class _InputIterator> - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - template <class _InputIterator> - unordered_map(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const key_equal& __eql, - const allocator_type& __a); - _LIBCPP_INLINE_VISIBILITY - explicit unordered_map(const allocator_type& __a); - unordered_map(const unordered_map& __u); - unordered_map(const unordered_map& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_map(unordered_map&& __u) - _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); - unordered_map(unordered_map&& __u, const allocator_type& __a); - unordered_map(initializer_list<value_type> __il); - unordered_map(initializer_list<value_type> __il, size_type __n, - const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); - unordered_map(initializer_list<value_type> __il, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY - unordered_map(size_type __n, const allocator_type& __a) - : unordered_map(__n, hasher(), key_equal(), __a) {} - _LIBCPP_INLINE_VISIBILITY - unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_map(__n, __hf, key_equal(), __a) {} - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) - : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {} - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {} - _LIBCPP_INLINE_VISIBILITY - unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) - : unordered_map(__il, __n, hasher(), key_equal(), __a) {} - _LIBCPP_INLINE_VISIBILITY - unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_map(__il, __n, __hf, key_equal(), __a) {} -#endif - _LIBCPP_INLINE_VISIBILITY - ~unordered_map() { - static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); - } - - _LIBCPP_INLINE_VISIBILITY - unordered_map& operator=(const unordered_map& __u) - { -#ifndef _LIBCPP_CXX03_LANG - __table_ = __u.__table_; -#else - if (this != _VSTD::addressof(__u)) { - __table_.clear(); - __table_.hash_function() = __u.__table_.hash_function(); - __table_.key_eq() = __u.__table_.key_eq(); - __table_.max_load_factor() = __u.__table_.max_load_factor(); - __table_.__copy_assign_alloc(__u.__table_); - insert(__u.begin(), __u.end()); - } -#endif - return *this; - } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_map& operator=(unordered_map&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); - _LIBCPP_INLINE_VISIBILITY - unordered_map& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT - {return allocator_type(__table_.__node_alloc());} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __table_.size() == 0;} - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return __table_.size();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT {return __table_.max_size();} - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return __table_.end();} - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert(const value_type& __x) - {return __table_.__insert_unique(__x);} - - iterator insert(const_iterator __p, const value_type& __x) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_map::insert(const_iterator, const value_type&) called with an iterator not " - "referring to this unordered_map"); - ((void)__p); - return insert(__x).first; - } - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert(value_type&& __x) - {return __table_.__insert_unique(_VSTD::move(__x));} - - iterator insert(const_iterator __p, value_type&& __x) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" - " referring to this unordered_map"); - ((void)__p); - return __table_.__insert_unique(_VSTD::move(__x)).first; - } - - template <class _Pp, - class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert(_Pp&& __x) - {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));} - - template <class _Pp, - class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, _Pp&& __x) - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_map::insert(const_iterator, value_type&&) called with an iterator not" - " referring to this unordered_map"); - ((void)__p); - return insert(_VSTD::forward<_Pp>(__x)).first; - } - - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> emplace(_Args&&... __args) { - return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...); - } - - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p, _Args&&... __args) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not" - " referring to this unordered_map"); - ((void)__p); - return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; - } - -#endif // _LIBCPP_CXX03_LANG - -#if _LIBCPP_STD_VER > 14 - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) - { - return __table_.__emplace_unique_key_args(__k, piecewise_construct, - _VSTD::forward_as_tuple(__k), - _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); - } - - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) - { - return __table_.__emplace_unique_key_args(__k, piecewise_construct, - _VSTD::forward_as_tuple(_VSTD::move(__k)), - _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); - } - - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this, - "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" - " referring to this unordered_map"); - ((void)__h); - return try_emplace(__k, _VSTD::forward<_Args>(__args)...).first; - } - - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) - { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this, - "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" - " referring to this unordered_map"); - ((void)__h); - return try_emplace(_VSTD::move(__k), _VSTD::forward<_Args>(__args)...).first; - } - - template <class _Vp> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) - { - pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, - __k, _VSTD::forward<_Vp>(__v)); - if (!__res.second) { - __res.first->second = _VSTD::forward<_Vp>(__v); - } - return __res; - } - - template <class _Vp> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) - { - pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, - _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); - if (!__res.second) { - __res.first->second = _VSTD::forward<_Vp>(__v); - } - return __res; - } - - template <class _Vp> - _LIBCPP_INLINE_VISIBILITY - iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v) - { - // FIXME: Add debug mode checking for the iterator input - return insert_or_assign(__k, _VSTD::forward<_Vp>(__v)).first; - } - - template <class _Vp> - _LIBCPP_INLINE_VISIBILITY - iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v) - { - // FIXME: Add debug mode checking for the iterator input - return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first; - } -#endif // _LIBCPP_STD_VER > 14 - - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(iterator __p) {return __table_.erase(__p.__i_);} - _LIBCPP_INLINE_VISIBILITY - size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __first, const_iterator __last) - {return __table_.erase(__first.__i_, __last.__i_);} - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {__table_.clear();} - -#if _LIBCPP_STD_VER > 14 - _LIBCPP_INLINE_VISIBILITY - insert_return_type insert(node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_map::insert()"); - return __table_.template __node_handle_insert_unique< - node_type, insert_return_type>(_VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __hint, node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_map::insert()"); - return __table_.template __node_handle_insert_unique<node_type>( - __hint.__i_, _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(key_type const& __key) - { - return __table_.template __node_handle_extract<node_type>(__key); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(const_iterator __it) - { - return __table_.template __node_handle_extract<node_type>( - __it.__i_); - } - - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_unique(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_unique(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_unique(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_unique(__source.__table_); - } -#endif - - _LIBCPP_INLINE_VISIBILITY - void swap(unordered_map& __u) - _NOEXCEPT_(__is_nothrow_swappable<__table>::value) - { __table_.swap(__u.__table_);} - - _LIBCPP_INLINE_VISIBILITY - hasher hash_function() const - {return __table_.hash_function().hash_function();} - _LIBCPP_INLINE_VISIBILITY - key_equal key_eq() const - {return __table_.key_eq().key_eq();} - - _LIBCPP_INLINE_VISIBILITY - iterator find(const key_type& __k) {return __table_.find(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - iterator find(const _K2& __k) {return __table_.find(__k);} - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} - - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const key_type& __k) - {return __table_.__equal_range_unique(__k);} - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const key_type& __k) const - {return __table_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const _K2& __k) - {return __table_.__equal_range_unique(__k);} - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const _K2& __k) const - {return __table_.__equal_range_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 - - mapped_type& operator[](const key_type& __k); -#ifndef _LIBCPP_CXX03_LANG - mapped_type& operator[](key_type&& __k); -#endif - - mapped_type& at(const key_type& __k); - const mapped_type& at(const key_type& __k) const; - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} - _LIBCPP_INLINE_VISIBILITY - size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_size(size_type __n) const - {return __table_.bucket_size(__n);} - _LIBCPP_INLINE_VISIBILITY - size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} - - _LIBCPP_INLINE_VISIBILITY - local_iterator begin(size_type __n) {return __table_.begin(__n);} - _LIBCPP_INLINE_VISIBILITY - local_iterator end(size_type __n) {return __table_.end(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator end(size_type __n) const {return __table_.cend(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} - - _LIBCPP_INLINE_VISIBILITY - float load_factor() const _NOEXCEPT {return __table_.load_factor();} - _LIBCPP_INLINE_VISIBILITY - float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} - _LIBCPP_INLINE_VISIBILITY - void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} - _LIBCPP_INLINE_VISIBILITY - void rehash(size_type __n) {__table_.rehash(__n);} - _LIBCPP_INLINE_VISIBILITY - void reserve(size_type __n) {__table_.reserve(__n);} - -#if _LIBCPP_DEBUG_LEVEL == 2 - - bool __dereferenceable(const const_iterator* __i) const - {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));} - bool __decrementable(const const_iterator* __i) const - {return __table_.__decrementable(_VSTD::addressof(__i->__i_));} - bool __addable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} - bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - -private: - -#ifdef _LIBCPP_CXX03_LANG - __node_holder __construct_node_with_key(const key_type& __k); -#endif -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Hash = hash<__iter_key_type<_InputIterator>>, - class _Pred = equal_to<__iter_key_type<_InputIterator>>, - class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>; - -template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>, - class _Pred = equal_to<remove_const_t<_Key>>, - class _Allocator = allocator<pair<const _Key, _Tp>>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(_InputIterator, _InputIterator, _Allocator) - -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; - -template<class _InputIterator, class _Hash, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; - -template<class _Key, class _Tp, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_map<remove_const_t<_Key>, _Tp, - hash<remove_const_t<_Key>>, - equal_to<remove_const_t<_Key>>, _Allocator>; - -template<class _Key, class _Tp, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator) - -> unordered_map<remove_const_t<_Key>, _Tp, - hash<remove_const_t<_Key>>, - equal_to<remove_const_t<_Key>>, _Allocator>; - -template<class _Key, class _Tp, class _Hash, class _Allocator, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, - equal_to<remove_const_t<_Key>>, _Allocator>; -#endif - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - size_type __n, const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a) - : __table_(__hf, __eql, typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - const allocator_type& __a) - : __table_(typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - _InputIterator __first, _InputIterator __last) -{ - _VSTD::__debug_db_insert_c(this); - insert(__first, __last); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - const unordered_map& __u) - : __table_(__u.__table_) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -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)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( - unordered_map&& __u) - _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()->swap(this, _VSTD::addressof(__u)); -#endif -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -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)) -{ - _VSTD::__debug_db_insert_c(this); - if (__a != __u.get_allocator()) - { - iterator __i = __u.begin(); - while (__u.size() != 0) { - __table_.__emplace_unique( - __u.__table_.remove((__i++).__i_)->__value_.__move()); - } - } -#if _LIBCPP_DEBUG_LEVEL == 2 - else - __get_db()->swap(this, _VSTD::addressof(__u)); -#endif -} - -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) -{ - _VSTD::__debug_db_insert_c(this); - insert(__il.begin(), __il.end()); -} - -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, size_type __n, const hasher& __hf, - const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -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, size_type __n, const hasher& __hf, - const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) -{ - __table_ = _VSTD::move(__u.__table_); - return *this; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( - initializer_list<value_type> __il) -{ - __table_.__assign_unique(__il.begin(), __il.end()); - return *this; -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -inline -void -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, - _InputIterator __last) -{ - for (; __first != __last; ++__first) - __table_.__insert_unique(*__first); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) -{ - return __table_.__emplace_unique_key_args(__k, - piecewise_construct, _VSTD::forward_as_tuple(__k), - _VSTD::forward_as_tuple()).first->__get_value().second; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) -{ - return __table_.__emplace_unique_key_args(__k, - piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)), - _VSTD::forward_as_tuple()).first->__get_value().second; -} -#else // _LIBCPP_CXX03_LANG - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) -{ - __node_allocator& __na = __table_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().first), __k); - __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second)); - __h.get_deleter().__second_constructed = true; - return __h; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) -{ - iterator __i = find(__k); - if (__i != end()) - return __i->second; - __node_holder __h = __construct_node_with_key(__k); - pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get()); - __h.release(); - return __r.first->second; -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) -{ - iterator __i = find(__k); - if (__i == end()) - __throw_out_of_range("unordered_map::at: key not found"); - return __i->second; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -const _Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const -{ - const_iterator __i = find(__k); - if (__i == end()) - __throw_out_of_range("unordered_map::at: key not found"); - return __i->second; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, - class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type - erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, - _Predicate __pred) { - return _VSTD::__libcpp_erase_if_container(__c, __pred); -} -#endif - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -bool -operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) -{ - if (__x.size() != __y.size()) - return false; - typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator - const_iterator; - for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); - __i != __ex; ++__i) - { - const_iterator __j = __y.find(__i->first); - if (__j == __ey || !(*__i == *__j)) - return false; - } - return true; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) -{ - return !(__x == __y); -} - -template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, - class _Alloc = allocator<pair<const _Key, _Tp> > > -class _LIBCPP_TEMPLATE_VIS unordered_multimap -{ -public: - // types - typedef _Key key_type; - typedef _Tp mapped_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; - typedef pair<const key_type, mapped_type> value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); - -private: - typedef __hash_value_type<key_type, mapped_type> __value_type; - typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; - typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; - typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, - __value_type>::type __allocator_type; - - typedef __hash_table<__value_type, __hasher, - __key_equal, __allocator_type> __table; - - __table __table_; - - typedef typename __table::_NodeTypes _NodeTypes; - typedef typename __table::__node_traits __node_traits; - typedef typename __table::__node_allocator __node_allocator; - typedef typename __table::__node __node; - typedef __hash_map_node_destructor<__node_allocator> _Dp; - typedef unique_ptr<__node, _Dp> __node_holder; - typedef allocator_traits<allocator_type> __alloc_traits; - static_assert((is_same<typename __node_traits::size_type, - typename __alloc_traits::size_type>::value), - "Allocator uses different size_type for different types"); -public: - typedef typename __alloc_traits::pointer pointer; - typedef typename __alloc_traits::const_pointer const_pointer; - typedef typename __table::size_type size_type; - typedef typename __table::difference_type difference_type; - - typedef __hash_map_iterator<typename __table::iterator> iterator; - typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; - typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; - typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; - -#if _LIBCPP_STD_VER > 14 - typedef __map_node_handle<__node, allocator_type> node_type; -#endif - - template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_map; - template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; - - _LIBCPP_INLINE_VISIBILITY - unordered_multimap() - _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { - _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, - const key_equal& __eql, - const allocator_type& __a); - template <class _InputIterator> - unordered_multimap(_InputIterator __first, _InputIterator __last); - template <class _InputIterator> - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - template <class _InputIterator> - unordered_multimap(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, - const key_equal& __eql, - const allocator_type& __a); - _LIBCPP_INLINE_VISIBILITY - explicit unordered_multimap(const allocator_type& __a); - unordered_multimap(const unordered_multimap& __u); - unordered_multimap(const unordered_multimap& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(unordered_multimap&& __u) - _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); - unordered_multimap(unordered_multimap&& __u, const allocator_type& __a); - unordered_multimap(initializer_list<value_type> __il); - unordered_multimap(initializer_list<value_type> __il, size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - unordered_multimap(initializer_list<value_type> __il, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(size_type __n, const allocator_type& __a) - : unordered_multimap(__n, hasher(), key_equal(), __a) {} - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multimap(__n, __hf, key_equal(), __a) {} - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) - : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {} - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {} - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) - : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {} - _LIBCPP_INLINE_VISIBILITY - unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, - const allocator_type& __a) - : unordered_multimap(__il, __n, __hf, key_equal(), __a) {} -#endif - _LIBCPP_INLINE_VISIBILITY - ~unordered_multimap() { - static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); - } - - _LIBCPP_INLINE_VISIBILITY - unordered_multimap& operator=(const unordered_multimap& __u) - { -#ifndef _LIBCPP_CXX03_LANG - __table_ = __u.__table_; -#else - if (this != _VSTD::addressof(__u)) { - __table_.clear(); - __table_.hash_function() = __u.__table_.hash_function(); - __table_.key_eq() = __u.__table_.key_eq(); - __table_.max_load_factor() = __u.__table_.max_load_factor(); - __table_.__copy_assign_alloc(__u.__table_); - insert(__u.begin(), __u.end()); - } -#endif - return *this; - } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_multimap& operator=(unordered_multimap&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); - _LIBCPP_INLINE_VISIBILITY - unordered_multimap& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT - {return allocator_type(__table_.__node_alloc());} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __table_.size() == 0;} - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return __table_.size();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT {return __table_.max_size();} - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return __table_.end();} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, const value_type& __x) - {return __table_.__insert_multi(__p.__i_, __x);} - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __x) - {return __table_.__insert_multi(__p.__i_, _VSTD::move(__x));} - - template <class _Pp, - class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator insert(_Pp&& __x) - {return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));} - - template <class _Pp, - class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, _Pp&& __x) - {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));} - - template <class... _Args> - iterator emplace(_Args&&... __args) { - return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...); - } - - template <class... _Args> - iterator emplace_hint(const_iterator __p, _Args&&... __args) { - return __table_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_Args>(__args)...); - } -#endif // _LIBCPP_CXX03_LANG - - - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(iterator __p) {return __table_.erase(__p.__i_);} - _LIBCPP_INLINE_VISIBILITY - size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __first, const_iterator __last) - {return __table_.erase(__first.__i_, __last.__i_);} - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {__table_.clear();} - -#if _LIBCPP_STD_VER > 14 - _LIBCPP_INLINE_VISIBILITY - iterator insert(node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_multimap::insert()"); - return __table_.template __node_handle_insert_multi<node_type>( - _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __hint, node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_multimap::insert()"); - return __table_.template __node_handle_insert_multi<node_type>( - __hint.__i_, _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(key_type const& __key) - { - return __table_.template __node_handle_extract<node_type>(__key); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(const_iterator __it) - { - return __table_.template __node_handle_extract<node_type>( - __it.__i_); - } - - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } -#endif - - _LIBCPP_INLINE_VISIBILITY - void swap(unordered_multimap& __u) - _NOEXCEPT_(__is_nothrow_swappable<__table>::value) - {__table_.swap(__u.__table_);} - - _LIBCPP_INLINE_VISIBILITY - hasher hash_function() const - {return __table_.hash_function().hash_function();} - _LIBCPP_INLINE_VISIBILITY - key_equal key_eq() const - {return __table_.key_eq().key_eq();} - - _LIBCPP_INLINE_VISIBILITY - iterator find(const key_type& __k) {return __table_.find(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - iterator find(const _K2& __k) {return __table_.find(__k);} - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} - - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const key_type& __k) - {return __table_.__equal_range_multi(__k);} - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const key_type& __k) const - {return __table_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const _K2& __k) - {return __table_.__equal_range_multi(__k);} - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const _K2& __k) const - {return __table_.__equal_range_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} - _LIBCPP_INLINE_VISIBILITY - size_type max_bucket_count() const _NOEXCEPT - {return __table_.max_bucket_count();} - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_size(size_type __n) const - {return __table_.bucket_size(__n);} - _LIBCPP_INLINE_VISIBILITY - size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} - - _LIBCPP_INLINE_VISIBILITY - local_iterator begin(size_type __n) {return __table_.begin(__n);} - _LIBCPP_INLINE_VISIBILITY - local_iterator end(size_type __n) {return __table_.end(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator end(size_type __n) const {return __table_.cend(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} - - _LIBCPP_INLINE_VISIBILITY - float load_factor() const _NOEXCEPT {return __table_.load_factor();} - _LIBCPP_INLINE_VISIBILITY - float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} - _LIBCPP_INLINE_VISIBILITY - void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} - _LIBCPP_INLINE_VISIBILITY - void rehash(size_type __n) {__table_.rehash(__n);} - _LIBCPP_INLINE_VISIBILITY - void reserve(size_type __n) {__table_.reserve(__n);} - -#if _LIBCPP_DEBUG_LEVEL == 2 - - bool __dereferenceable(const const_iterator* __i) const - {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));} - bool __decrementable(const const_iterator* __i) const - {return __table_.__decrementable(_VSTD::addressof(__i->__i_));} - bool __addable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} - bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - - -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Hash = hash<__iter_key_type<_InputIterator>>, - class _Pred = equal_to<__iter_key_type<_InputIterator>>, - class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>; - -template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>, - class _Pred = equal_to<remove_const_t<_Key>>, - class _Allocator = allocator<pair<const _Key, _Tp>>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(_InputIterator, _InputIterator, _Allocator) - -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; - -template<class _InputIterator, class _Hash, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; - -template<class _Key, class _Tp, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_multimap<remove_const_t<_Key>, _Tp, - hash<remove_const_t<_Key>>, - equal_to<remove_const_t<_Key>>, _Allocator>; - -template<class _Key, class _Tp, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator) - -> unordered_multimap<remove_const_t<_Key>, _Tp, - hash<remove_const_t<_Key>>, - equal_to<remove_const_t<_Key>>, _Allocator>; - -template<class _Key, class _Tp, class _Hash, class _Allocator, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, - equal_to<remove_const_t<_Key>>, _Allocator>; -#endif - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - size_type __n, const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a) - : __table_(__hf, __eql, typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - _InputIterator __first, _InputIterator __last) -{ - _VSTD::__debug_db_insert_c(this); - insert(__first, __last); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - const allocator_type& __a) - : __table_(typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - const unordered_multimap& __u) - : __table_(__u.__table_) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -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)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( - unordered_multimap&& __u) - _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()->swap(this, _VSTD::addressof(__u)); -#endif -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -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)) -{ - _VSTD::__debug_db_insert_c(this); - if (__a != __u.get_allocator()) - { - iterator __i = __u.begin(); - while (__u.size() != 0) - { - __table_.__insert_multi( - __u.__table_.remove((__i++).__i_)->__value_.__move()); - } - } -#if _LIBCPP_DEBUG_LEVEL == 2 - else - __get_db()->swap(this, _VSTD::addressof(__u)); -#endif -} - -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) -{ - _VSTD::__debug_db_insert_c(this); - insert(__il.begin(), __il.end()); -} - -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, size_type __n, const hasher& __hf, - const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -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, size_type __n, const hasher& __hf, - const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, typename __table::allocator_type(__a)) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) -{ - __table_ = _VSTD::move(__u.__table_); - return *this; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( - initializer_list<value_type> __il) -{ - __table_.__assign_multi(__il.begin(), __il.end()); - return *this; -} - -#endif // _LIBCPP_CXX03_LANG - - - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -inline -void -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, - _InputIterator __last) -{ - for (; __first != __last; ++__first) - __table_.__insert_multi(*__first); -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, - class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type - erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, - _Predicate __pred) { - return _VSTD::__libcpp_erase_if_container(__c, __pred); -} -#endif - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -bool -operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) -{ - if (__x.size() != __y.size()) - return false; - typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator - const_iterator; - typedef pair<const_iterator, const_iterator> _EqRng; - for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) - { - _EqRng __xeq = __x.equal_range(__i->first); - _EqRng __yeq = __y.equal_range(__i->first); - if (_VSTD::distance(__xeq.first, __xeq.second) != - _VSTD::distance(__yeq.first, __yeq.second) || - !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) - return false; - __i = __xeq.second; - } - return true; -} - -template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) -{ - return !(__x == __y); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_UNORDERED_MAP diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set b/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set deleted file mode 100644 index 2f902cc793..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/unordered_set +++ /dev/null @@ -1,1807 +0,0 @@ -// -*- 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_UNORDERED_SET -#define _LIBCPP_UNORDERED_SET - -/* - - unordered_set synopsis - -#include <initializer_list> - -namespace std -{ - -template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, - class Alloc = allocator<Value>> -class unordered_set -{ -public: - // types - typedef Value key_type; - typedef key_type value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - typedef unspecified node_type unspecified; // C++17 - typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 - - unordered_set() - noexcept( - is_nothrow_default_constructible<hasher>::value && - is_nothrow_default_constructible<key_equal>::value && - is_nothrow_default_constructible<allocator_type>::value); - explicit unordered_set(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template <class InputIterator> - unordered_set(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit unordered_set(const allocator_type&); - unordered_set(const unordered_set&); - unordered_set(const unordered_set&, const Allocator&); - unordered_set(unordered_set&&) - noexcept( - is_nothrow_move_constructible<hasher>::value && - is_nothrow_move_constructible<key_equal>::value && - is_nothrow_move_constructible<allocator_type>::value); - unordered_set(unordered_set&&, const Allocator&); - unordered_set(initializer_list<value_type>, size_type n = 0, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - unordered_set(size_type n, const allocator_type& a); // C++14 - unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14 - template <class InputIterator> - unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 - template <class InputIterator> - unordered_set(InputIterator f, InputIterator l, size_type n, - const hasher& hf, const allocator_type& a); // C++14 - unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 - unordered_set(initializer_list<value_type> il, size_type n, - const hasher& hf, const allocator_type& a); // C++14 - ~unordered_set(); - unordered_set& operator=(const unordered_set&); - unordered_set& operator=(unordered_set&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<hasher>::value && - is_nothrow_move_assignable<key_equal>::value); - unordered_set& operator=(initializer_list<value_type>); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template <class... Args> - pair<iterator, bool> emplace(Args&&... args); - template <class... Args> - iterator emplace_hint(const_iterator position, Args&&... args); - pair<iterator, bool> insert(const value_type& obj); - pair<iterator, bool> insert(value_type&& obj); - iterator insert(const_iterator hint, const value_type& obj); - iterator insert(const_iterator hint, value_type&& obj); - template <class InputIterator> - void insert(InputIterator first, InputIterator last); - void insert(initializer_list<value_type>); - - node_type extract(const_iterator position); // C++17 - node_type extract(const key_type& x); // C++17 - insert_return_type insert(node_type&& nh); // C++17 - iterator insert(const_iterator hint, node_type&& nh); // C++17 - - iterator erase(const_iterator position); - iterator erase(iterator position); // C++14 - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - template<class H2, class P2> - void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 - template<class H2, class P2> - void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 - - void swap(unordered_set&) - noexcept(allocator_traits<Allocator>::is_always_equal::value && - noexcept(swap(declval<hasher&>(), declval<hasher&>())) && - noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - template<typename K> - iterator find(const K& x); // C++20 - template<typename K> - const_iterator find(const K& x) const; // C++20 - size_type count(const key_type& k) const; - template<typename K> - size_type count(const K& k) const; // C++20 - bool contains(const key_type& k) const; // C++20 - template<typename K> - bool contains(const K& k) const; // C++20 - pair<iterator, iterator> equal_range(const key_type& k); - pair<const_iterator, const_iterator> equal_range(const key_type& k) const; - template<typename K> - pair<iterator, iterator> equal_range(const K& k); // C++20 - template<typename K> - pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; - -template<class InputIterator, - class Hash = hash<typename iterator_traits<InputIterator>::value_type>, - class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>, - class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> -unordered_set(InputIterator, InputIterator, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_set<typename iterator_traits<InputIterator>::value_type, - Hash, Pred, Allocator>; // C++17 - -template<class T, class Hash = hash<T>, - class Pred = equal_to<T>, class Allocator = allocator<T>> -unordered_set(initializer_list<T>, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_set<T, Hash, Pred, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -unordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator) - -> unordered_set<typename iterator_traits<InputIterator>::value_type, - hash<typename iterator_traits<InputIterator>::value_type>, - equal_to<typename iterator_traits<InputIterator>::value_type>, - Allocator>; // C++17 - -template<class InputIterator, class Hash, class Allocator> -unordered_set(InputIterator, InputIterator, typename see below::size_type, - Hash, Allocator) - -> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash, - equal_to<typename iterator_traits<InputIterator>::value_type>, - Allocator>; // C++17 - -template<class T, class Allocator> -unordered_set(initializer_list<T>, typename see below::size_type, Allocator) - -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; // C++17 - -template<class T, class Hash, class Allocator> -unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator) - -> unordered_set<T, Hash, equal_to<T>, Allocator>; // C++17 - -template <class Value, class Hash, class Pred, class Alloc> - void swap(unordered_set<Value, Hash, Pred, Alloc>& x, - unordered_set<Value, Hash, Pred, Alloc>& y) - noexcept(noexcept(x.swap(y))); - -template <class Value, class Hash, class Pred, class Alloc> - bool - operator==(const unordered_set<Value, Hash, Pred, Alloc>& x, - const unordered_set<Value, Hash, Pred, Alloc>& y); - -template <class Value, class Hash, class Pred, class Alloc> - bool - operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x, - const unordered_set<Value, Hash, Pred, Alloc>& y); - -template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, - class Alloc = allocator<Value>> -class unordered_multiset -{ -public: - // types - typedef Value key_type; - typedef key_type value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - typedef unspecified node_type unspecified; // C++17 - - unordered_multiset() - noexcept( - is_nothrow_default_constructible<hasher>::value && - is_nothrow_default_constructible<key_equal>::value && - is_nothrow_default_constructible<allocator_type>::value); - explicit unordered_multiset(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template <class InputIterator> - unordered_multiset(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit unordered_multiset(const allocator_type&); - unordered_multiset(const unordered_multiset&); - unordered_multiset(const unordered_multiset&, const Allocator&); - unordered_multiset(unordered_multiset&&) - noexcept( - is_nothrow_move_constructible<hasher>::value && - is_nothrow_move_constructible<key_equal>::value && - is_nothrow_move_constructible<allocator_type>::value); - unordered_multiset(unordered_multiset&&, const Allocator&); - unordered_multiset(initializer_list<value_type>, size_type n = /see below/, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - unordered_multiset(size_type n, const allocator_type& a); // C++14 - unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14 - template <class InputIterator> - unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 - template <class InputIterator> - unordered_multiset(InputIterator f, InputIterator l, size_type n, - const hasher& hf, const allocator_type& a); // C++14 - unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 - unordered_multiset(initializer_list<value_type> il, size_type n, - const hasher& hf, const allocator_type& a); // C++14 - ~unordered_multiset(); - unordered_multiset& operator=(const unordered_multiset&); - unordered_multiset& operator=(unordered_multiset&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<hasher>::value && - is_nothrow_move_assignable<key_equal>::value); - unordered_multiset& operator=(initializer_list<value_type>); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template <class... Args> - iterator emplace(Args&&... args); - template <class... Args> - iterator emplace_hint(const_iterator position, Args&&... args); - iterator insert(const value_type& obj); - iterator insert(value_type&& obj); - iterator insert(const_iterator hint, const value_type& obj); - iterator insert(const_iterator hint, value_type&& obj); - template <class InputIterator> - void insert(InputIterator first, InputIterator last); - void insert(initializer_list<value_type>); - - node_type extract(const_iterator position); // C++17 - node_type extract(const key_type& x); // C++17 - iterator insert(node_type&& nh); // C++17 - iterator insert(const_iterator hint, node_type&& nh); // C++17 - - iterator erase(const_iterator position); - iterator erase(iterator position); // C++14 - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - template<class H2, class P2> - void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 - template<class H2, class P2> - void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 - template<class H2, class P2> - void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 - - void swap(unordered_multiset&) - noexcept(allocator_traits<Allocator>::is_always_equal::value && - noexcept(swap(declval<hasher&>(), declval<hasher&>())) && - noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - template<typename K> - iterator find(const K& x); // C++20 - template<typename K> - const_iterator find(const K& x) const; // C++20 - size_type count(const key_type& k) const; - template<typename K> - size_type count(const K& k) const; // C++20 - bool contains(const key_type& k) const; // C++20 - template<typename K> - bool contains(const K& k) const; // C++20 - pair<iterator, iterator> equal_range(const key_type& k); - pair<const_iterator, const_iterator> equal_range(const key_type& k) const; - template<typename K> - pair<iterator, iterator> equal_range(const K& k); // C++20 - template<typename K> - pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; - -template<class InputIterator, - class Hash = hash<typename iterator_traits<InputIterator>::value_type>, - class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>, - class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> -unordered_multiset(InputIterator, InputIterator, see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, - Hash, Pred, Allocator>; // C++17 - -template<class T, class Hash = hash<T>, - class Pred = equal_to<T>, class Allocator = allocator<T>> -unordered_multiset(initializer_list<T>, typename see below::size_type = see below, - Hash = Hash(), Pred = Pred(), Allocator = Allocator()) - -> unordered_multiset<T, Hash, Pred, Allocator>; // C++17 - -template<class InputIterator, class Allocator> -unordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator) - -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, - hash<typename iterator_traits<InputIterator>::value_type>, - equal_to<typename iterator_traits<InputIterator>::value_type>, - Allocator>; // C++17 - -template<class InputIterator, class Hash, class Allocator> -unordered_multiset(InputIterator, InputIterator, typename see below::size_type, - Hash, Allocator) - -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash, - equal_to<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 - -template<class T, class Allocator> -unordered_multiset(initializer_list<T>, typename see below::size_type, Allocator) - -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>; // C++17 - -template<class T, class Hash, class Allocator> -unordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator) - -> unordered_multiset<T, Hash, equal_to<T>, Allocator>; // C++17 - -template <class Value, class Hash, class Pred, class Alloc> - void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x, - unordered_multiset<Value, Hash, Pred, Alloc>& y) - noexcept(noexcept(x.swap(y))); - -template <class K, class T, class H, class P, class A, class Predicate> - typename unordered_set<K, T, H, P, A>::size_type - erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20 - -template <class K, class T, class H, class P, class A, class Predicate> - typename unordered_multiset<K, T, H, P, A>::size_type - erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20 - - -template <class Value, class Hash, class Pred, class Alloc> - bool - operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x, - const unordered_multiset<Value, Hash, Pred, Alloc>& y); - -template <class Value, class Hash, class Pred, class Alloc> - bool - operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x, - const unordered_multiset<Value, Hash, Pred, Alloc>& y); -} // std - -*/ - -#include <__algorithm/is_permutation.h> -#include <__assert> -#include <__config> -#include <__debug> -#include <__functional/is_transparent.h> -#include <__hash_table> -#include <__memory/addressof.h> -#include <__node_handle> -#include <__utility/forward.h> -#include <compare> -#include <functional> -#include <iterator> // __libcpp_erase_if_container -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Value, class _Hash, class _Pred, class _Alloc> -class unordered_multiset; - -template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, - class _Alloc = allocator<_Value> > -class _LIBCPP_TEMPLATE_VIS unordered_set -{ -public: - // types - typedef _Value key_type; - typedef key_type value_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); - -private: - typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; - - __table __table_; - -public: - typedef typename __table::pointer pointer; - typedef typename __table::const_pointer const_pointer; - typedef typename __table::size_type size_type; - typedef typename __table::difference_type difference_type; - - typedef typename __table::const_iterator iterator; - typedef typename __table::const_iterator const_iterator; - typedef typename __table::const_local_iterator local_iterator; - typedef typename __table::const_local_iterator const_local_iterator; - -#if _LIBCPP_STD_VER > 14 - typedef __set_node_handle<typename __table::__node, allocator_type> node_type; - typedef __insert_return_type<iterator, node_type> insert_return_type; -#endif - - template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_set; - template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; - - _LIBCPP_INLINE_VISIBILITY - unordered_set() - _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { - _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 - inline _LIBCPP_INLINE_VISIBILITY - unordered_set(size_type __n, const allocator_type& __a) - : unordered_set(__n, hasher(), key_equal(), __a) {} - inline _LIBCPP_INLINE_VISIBILITY - unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_set(__n, __hf, key_equal(), __a) {} -#endif - unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a); - template <class _InputIterator> - unordered_set(_InputIterator __first, _InputIterator __last); - template <class _InputIterator> - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - template <class _InputIterator> - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 - template <class _InputIterator> - inline _LIBCPP_INLINE_VISIBILITY - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, const allocator_type& __a) - : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {} - template <class _InputIterator> - unordered_set(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} -#endif - _LIBCPP_INLINE_VISIBILITY - explicit unordered_set(const allocator_type& __a); - unordered_set(const unordered_set& __u); - unordered_set(const unordered_set& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_set(unordered_set&& __u) - _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); - unordered_set(unordered_set&& __u, const allocator_type& __a); - unordered_set(initializer_list<value_type> __il); - unordered_set(initializer_list<value_type> __il, size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - unordered_set(initializer_list<value_type> __il, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 - inline _LIBCPP_INLINE_VISIBILITY - unordered_set(initializer_list<value_type> __il, size_type __n, - const allocator_type& __a) - : unordered_set(__il, __n, hasher(), key_equal(), __a) {} - inline _LIBCPP_INLINE_VISIBILITY - unordered_set(initializer_list<value_type> __il, size_type __n, - const hasher& __hf, const allocator_type& __a) - : unordered_set(__il, __n, __hf, key_equal(), __a) {} -#endif -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - ~unordered_set() { - static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); - } - - _LIBCPP_INLINE_VISIBILITY - unordered_set& operator=(const unordered_set& __u) - { - __table_ = __u.__table_; - return *this; - } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_set& operator=(unordered_set&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); - _LIBCPP_INLINE_VISIBILITY - unordered_set& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT - {return allocator_type(__table_.__node_alloc());} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __table_.size() == 0;} - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return __table_.size();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT {return __table_.max_size();} - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return __table_.end();} - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> emplace(_Args&&... __args) - {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator emplace_hint(const_iterator __p, _Args&&... __args) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" - " referring to this unordered_set"); - return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; - } -#else - iterator emplace_hint(const_iterator, _Args&&... __args) - {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;} -#endif - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert(value_type&& __x) - {return __table_.__insert_unique(_VSTD::move(__x));} - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator insert(const_iterator __p, value_type&& __x) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" - " referring to this unordered_set"); - return insert(_VSTD::move(__x)).first; - } -#else - iterator insert(const_iterator, value_type&& __x) - {return insert(_VSTD::move(__x)).first;} -#endif - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - pair<iterator, bool> insert(const value_type& __x) - {return __table_.__insert_unique(__x);} - - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL == 2 - iterator insert(const_iterator __p, const value_type& __x) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, - "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" - " referring to this unordered_set"); - return insert(__x).first; - } -#else - iterator insert(const_iterator, const value_type& __x) - {return insert(__x).first;} -#endif - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); - - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __p) {return __table_.erase(__p);} - _LIBCPP_INLINE_VISIBILITY - size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __first, const_iterator __last) - {return __table_.erase(__first, __last);} - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {__table_.clear();} - -#if _LIBCPP_STD_VER > 14 - _LIBCPP_INLINE_VISIBILITY - insert_return_type insert(node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_set::insert()"); - return __table_.template __node_handle_insert_unique< - node_type, insert_return_type>(_VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __h, node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_set::insert()"); - return __table_.template __node_handle_insert_unique<node_type>( - __h, _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(key_type const& __key) - { - return __table_.template __node_handle_extract<node_type>(__key); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(const_iterator __it) - { - return __table_.template __node_handle_extract<node_type>(__it); - } - - template<class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __table_.__node_handle_merge_unique(__source.__table_); - } - template<class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __table_.__node_handle_merge_unique(__source.__table_); - } - template<class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __table_.__node_handle_merge_unique(__source.__table_); - } - template<class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - __table_.__node_handle_merge_unique(__source.__table_); - } -#endif - - _LIBCPP_INLINE_VISIBILITY - void swap(unordered_set& __u) - _NOEXCEPT_(__is_nothrow_swappable<__table>::value) - {__table_.swap(__u.__table_);} - - _LIBCPP_INLINE_VISIBILITY - hasher hash_function() const {return __table_.hash_function();} - _LIBCPP_INLINE_VISIBILITY - key_equal key_eq() const {return __table_.key_eq();} - - _LIBCPP_INLINE_VISIBILITY - iterator find(const key_type& __k) {return __table_.find(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - iterator find(const _K2& __k) {return __table_.find(__k);} - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} - - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const key_type& __k) - {return __table_.__equal_range_unique(__k);} - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const key_type& __k) const - {return __table_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 17 - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const _K2& __k) - {return __table_.__equal_range_unique(__k);} - template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const _K2& __k) const - {return __table_.__equal_range_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} - _LIBCPP_INLINE_VISIBILITY - size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} - _LIBCPP_INLINE_VISIBILITY - size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} - - _LIBCPP_INLINE_VISIBILITY - local_iterator begin(size_type __n) {return __table_.begin(__n);} - _LIBCPP_INLINE_VISIBILITY - local_iterator end(size_type __n) {return __table_.end(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator end(size_type __n) const {return __table_.cend(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} - - _LIBCPP_INLINE_VISIBILITY - float load_factor() const _NOEXCEPT {return __table_.load_factor();} - _LIBCPP_INLINE_VISIBILITY - float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} - _LIBCPP_INLINE_VISIBILITY - void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} - _LIBCPP_INLINE_VISIBILITY - void rehash(size_type __n) {__table_.rehash(__n);} - _LIBCPP_INLINE_VISIBILITY - void reserve(size_type __n) {__table_.reserve(__n);} - -#if _LIBCPP_DEBUG_LEVEL == 2 - - bool __dereferenceable(const const_iterator* __i) const - {return __table_.__dereferenceable(__i);} - bool __decrementable(const const_iterator* __i) const - {return __table_.__decrementable(__i);} - bool __addable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(__i, __n);} - bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(__i, __n);} - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Hash = hash<__iter_value_type<_InputIterator>>, - class _Pred = equal_to<__iter_value_type<_InputIterator>>, - class _Allocator = allocator<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; - -template<class _Tp, class _Hash = hash<_Tp>, - class _Pred = equal_to<_Tp>, - class _Allocator = allocator<_Tp>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_set<_Tp, _Hash, _Pred, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_set(_InputIterator, _InputIterator, - typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_set<__iter_value_type<_InputIterator>, - hash<__iter_value_type<_InputIterator>>, - equal_to<__iter_value_type<_InputIterator>>, - _Allocator>; - -template<class _InputIterator, class _Hash, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_set(_InputIterator, _InputIterator, - typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_set<__iter_value_type<_InputIterator>, _Hash, - equal_to<__iter_value_type<_InputIterator>>, - _Allocator>; - -template<class _Tp, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; - -template<class _Tp, class _Hash, class _Allocator, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; -#endif - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, - const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -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) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - _InputIterator __first, _InputIterator __last) -{ - _VSTD::__debug_db_insert_c(this); - insert(__first, __last); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - const allocator_type& __a) - : __table_(__a) -{ - _VSTD::__debug_db_insert_c(this); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - const unordered_set& __u) - : __table_(__u.__table_) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - const unordered_set& __u, const allocator_type& __a) - : __table_(__u.__table_, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - unordered_set&& __u) - _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()->swap(this, _VSTD::addressof(__u)); -#endif -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - unordered_set&& __u, const allocator_type& __a) - : __table_(_VSTD::move(__u.__table_), __a) -{ - _VSTD::__debug_db_insert_c(this); - if (__a != __u.get_allocator()) - { - iterator __i = __u.begin(); - while (__u.size() != 0) - __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); - } -#if _LIBCPP_DEBUG_LEVEL == 2 - else - __get_db()->swap(this, _VSTD::addressof(__u)); -#endif -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - initializer_list<value_type> __il) -{ - _VSTD::__debug_db_insert_c(this); - insert(__il.begin(), __il.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - initializer_list<value_type> __il, size_type __n, const hasher& __hf, - const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( - initializer_list<value_type> __il, size_type __n, const hasher& __hf, - const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_set<_Value, _Hash, _Pred, _Alloc>& -unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) -{ - __table_ = _VSTD::move(__u.__table_); - return *this; -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_set<_Value, _Hash, _Pred, _Alloc>& -unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( - initializer_list<value_type> __il) -{ - __table_.__assign_unique(__il.begin(), __il.end()); - return *this; -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -inline -void -unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, - _InputIterator __last) -{ - for (; __first != __last; ++__first) - __table_.__insert_unique(*__first); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Value, class _Hash, class _Pred, class _Alloc, - class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type - erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, - _Predicate __pred) { - return _VSTD::__libcpp_erase_if_container(__c, __pred); -} -#endif - -template <class _Value, class _Hash, class _Pred, class _Alloc> -bool -operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) -{ - if (__x.size() != __y.size()) - return false; - typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator - const_iterator; - for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); - __i != __ex; ++__i) - { - const_iterator __j = __y.find(*__i); - if (__j == __ey || !(*__i == *__j)) - return false; - } - return true; -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) -{ - return !(__x == __y); -} - -template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, - class _Alloc = allocator<_Value> > -class _LIBCPP_TEMPLATE_VIS unordered_multiset -{ -public: - // types - typedef _Value key_type; - typedef key_type value_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); - -private: - typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; - - __table __table_; - -public: - typedef typename __table::pointer pointer; - typedef typename __table::const_pointer const_pointer; - typedef typename __table::size_type size_type; - typedef typename __table::difference_type difference_type; - - typedef typename __table::const_iterator iterator; - typedef typename __table::const_iterator const_iterator; - typedef typename __table::const_local_iterator local_iterator; - typedef typename __table::const_local_iterator const_local_iterator; - -#if _LIBCPP_STD_VER > 14 - typedef __set_node_handle<typename __table::__node, allocator_type> node_type; -#endif - - template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_set; - template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> - friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; - - _LIBCPP_INLINE_VISIBILITY - unordered_multiset() - _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) - { - _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, - const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 - inline _LIBCPP_INLINE_VISIBILITY - unordered_multiset(size_type __n, const allocator_type& __a) - : unordered_multiset(__n, hasher(), key_equal(), __a) {} - inline _LIBCPP_INLINE_VISIBILITY - unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multiset(__n, __hf, key_equal(), __a) {} -#endif - template <class _InputIterator> - unordered_multiset(_InputIterator __first, _InputIterator __last); - template <class _InputIterator> - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - template <class _InputIterator> - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n , const hasher& __hf, - const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 - template <class _InputIterator> - inline _LIBCPP_INLINE_VISIBILITY - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, const allocator_type& __a) - : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {} - template <class _InputIterator> - inline _LIBCPP_INLINE_VISIBILITY - unordered_multiset(_InputIterator __first, _InputIterator __last, - size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} -#endif - _LIBCPP_INLINE_VISIBILITY - explicit unordered_multiset(const allocator_type& __a); - unordered_multiset(const unordered_multiset& __u); - unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_multiset(unordered_multiset&& __u) - _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); - unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); - unordered_multiset(initializer_list<value_type> __il); - unordered_multiset(initializer_list<value_type> __il, size_type __n, - const hasher& __hf = hasher(), - const key_equal& __eql = key_equal()); - unordered_multiset(initializer_list<value_type> __il, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 - inline _LIBCPP_INLINE_VISIBILITY - unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) - : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} - inline _LIBCPP_INLINE_VISIBILITY - unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} -#endif -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - ~unordered_multiset() { - static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); - } - - _LIBCPP_INLINE_VISIBILITY - unordered_multiset& operator=(const unordered_multiset& __u) - { - __table_ = __u.__table_; - return *this; - } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - unordered_multiset& operator=(unordered_multiset&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); - unordered_multiset& operator=(initializer_list<value_type> __il); -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const _NOEXCEPT - {return allocator_type(__table_.__node_alloc());} - - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return __table_.size() == 0;} - _LIBCPP_INLINE_VISIBILITY - size_type size() const _NOEXCEPT {return __table_.size();} - _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT {return __table_.max_size();} - - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT {return __table_.end();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} - _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT {return __table_.end();} - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator emplace(_Args&&... __args) - {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} - template <class... _Args> - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p, _Args&&... __args) - {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __x) - {return __table_.__insert_multi(__p, _VSTD::move(__x));} - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, const value_type& __x) - {return __table_.__insert_multi(__p, __x);} - - template <class _InputIterator> - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); - -#if _LIBCPP_STD_VER > 14 - _LIBCPP_INLINE_VISIBILITY - iterator insert(node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_multiset::insert()"); - return __table_.template __node_handle_insert_multi<node_type>( - _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __hint, node_type&& __nh) - { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), - "node_type with incompatible allocator passed to unordered_multiset::insert()"); - return __table_.template __node_handle_insert_multi<node_type>( - __hint, _VSTD::move(__nh)); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(const_iterator __position) - { - return __table_.template __node_handle_extract<node_type>( - __position); - } - _LIBCPP_INLINE_VISIBILITY - node_type extract(key_type const& __key) - { - return __table_.template __node_handle_extract<node_type>(__key); - } - - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } - template <class _H2, class _P2> - _LIBCPP_INLINE_VISIBILITY - void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) - { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); - return __table_.__node_handle_merge_multi(__source.__table_); - } -#endif - - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __p) {return __table_.erase(__p);} - _LIBCPP_INLINE_VISIBILITY - size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} - _LIBCPP_INLINE_VISIBILITY - iterator erase(const_iterator __first, const_iterator __last) - {return __table_.erase(__first, __last);} - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT {__table_.clear();} - - _LIBCPP_INLINE_VISIBILITY - void swap(unordered_multiset& __u) - _NOEXCEPT_(__is_nothrow_swappable<__table>::value) - {__table_.swap(__u.__table_);} - - _LIBCPP_INLINE_VISIBILITY - hasher hash_function() const {return __table_.hash_function();} - _LIBCPP_INLINE_VISIBILITY - key_equal key_eq() const {return __table_.key_eq();} - - _LIBCPP_INLINE_VISIBILITY - iterator find(const key_type& __k) {return __table_.find(__k);} - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 - template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - iterator find(const _K2& __k) {return __table_.find(__k);} - template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 17 - template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} - - template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const key_type& __k) - {return __table_.__equal_range_multi(__k);} - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const key_type& __k) const - {return __table_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 17 - template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<iterator, iterator> equal_range(const _K2& __k) - {return __table_.__equal_range_multi(__k);} - template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> - _LIBCPP_INLINE_VISIBILITY - pair<const_iterator, const_iterator> equal_range(const _K2& __k) const - {return __table_.__equal_range_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} - _LIBCPP_INLINE_VISIBILITY - size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} - - _LIBCPP_INLINE_VISIBILITY - size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} - _LIBCPP_INLINE_VISIBILITY - size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} - - _LIBCPP_INLINE_VISIBILITY - local_iterator begin(size_type __n) {return __table_.begin(__n);} - _LIBCPP_INLINE_VISIBILITY - local_iterator end(size_type __n) {return __table_.end(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator end(size_type __n) const {return __table_.cend(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} - _LIBCPP_INLINE_VISIBILITY - const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} - - _LIBCPP_INLINE_VISIBILITY - float load_factor() const _NOEXCEPT {return __table_.load_factor();} - _LIBCPP_INLINE_VISIBILITY - float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} - _LIBCPP_INLINE_VISIBILITY - void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} - _LIBCPP_INLINE_VISIBILITY - void rehash(size_type __n) {__table_.rehash(__n);} - _LIBCPP_INLINE_VISIBILITY - void reserve(size_type __n) {__table_.reserve(__n);} - -#if _LIBCPP_DEBUG_LEVEL == 2 - - bool __dereferenceable(const const_iterator* __i) const - {return __table_.__dereferenceable(__i);} - bool __decrementable(const const_iterator* __i) const - {return __table_.__decrementable(__i);} - bool __addable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(__i, __n);} - bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(__i, __n);} - -#endif // _LIBCPP_DEBUG_LEVEL == 2 - -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _InputIterator, - class _Hash = hash<__iter_value_type<_InputIterator>>, - class _Pred = equal_to<__iter_value_type<_InputIterator>>, - class _Allocator = allocator<__iter_value_type<_InputIterator>>, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; - -template<class _Tp, class _Hash = hash<_Tp>, - class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<!__is_allocator<_Pred>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, - _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) - -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>; - -template<class _InputIterator, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_multiset<__iter_value_type<_InputIterator>, - hash<__iter_value_type<_InputIterator>>, - equal_to<__iter_value_type<_InputIterator>>, - _Allocator>; - -template<class _InputIterator, class _Hash, class _Allocator, - class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, - _Hash, _Allocator) - -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, - equal_to<__iter_value_type<_InputIterator>>, - _Allocator>; - -template<class _Tp, class _Allocator, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) - -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; - -template<class _Tp, class _Hash, class _Allocator, - class = enable_if_t<!__is_allocator<_Hash>::value>, - class = enable_if_t<!is_integral<_Hash>::value>, - class = enable_if_t<__is_allocator<_Allocator>::value>> -unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) - -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; -#endif - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - size_type __n, const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a) - : __table_(__hf, __eql, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - _InputIterator __first, _InputIterator __last) -{ - _VSTD::__debug_db_insert_c(this); - insert(__first, __last); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - _InputIterator __first, _InputIterator __last, size_type __n, - const hasher& __hf, const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__first, __last); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - const allocator_type& __a) - : __table_(__a) -{ - _VSTD::__debug_db_insert_c(this); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - const unordered_multiset& __u) - : __table_(__u.__table_) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - const unordered_multiset& __u, const allocator_type& __a) - : __table_(__u.__table_, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__u.bucket_count()); - insert(__u.begin(), __u.end()); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - unordered_multiset&& __u) - _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()->swap(this, _VSTD::addressof(__u)); -#endif -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - unordered_multiset&& __u, const allocator_type& __a) - : __table_(_VSTD::move(__u.__table_), __a) -{ - _VSTD::__debug_db_insert_c(this); - if (__a != __u.get_allocator()) - { - iterator __i = __u.begin(); - while (__u.size() != 0) - __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); - } -#if _LIBCPP_DEBUG_LEVEL == 2 - else - __get_db()->swap(this, _VSTD::addressof(__u)); -#endif -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - initializer_list<value_type> __il) -{ - _VSTD::__debug_db_insert_c(this); - insert(__il.begin(), __il.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - initializer_list<value_type> __il, size_type __n, const hasher& __hf, - const key_equal& __eql) - : __table_(__hf, __eql) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( - initializer_list<value_type> __il, size_type __n, const hasher& __hf, - const key_equal& __eql, const allocator_type& __a) - : __table_(__hf, __eql, __a) -{ - _VSTD::__debug_db_insert_c(this); - __table_.rehash(__n); - insert(__il.begin(), __il.end()); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_multiset<_Value, _Hash, _Pred, _Alloc>& -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( - unordered_multiset&& __u) - _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) -{ - __table_ = _VSTD::move(__u.__table_); - return *this; -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline -unordered_multiset<_Value, _Hash, _Pred, _Alloc>& -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( - initializer_list<value_type> __il) -{ - __table_.__assign_multi(__il.begin(), __il.end()); - return *this; -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _Value, class _Hash, class _Pred, class _Alloc> -template <class _InputIterator> -inline -void -unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, - _InputIterator __last) -{ - for (; __first != __last; ++__first) - __table_.__insert_multi(*__first); -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) -{ - __x.swap(__y); -} - -#if _LIBCPP_STD_VER > 17 -template <class _Value, class _Hash, class _Pred, class _Alloc, - class _Predicate> -inline _LIBCPP_INLINE_VISIBILITY - typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type - erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, - _Predicate __pred) { - return _VSTD::__libcpp_erase_if_container(__c, __pred); -} -#endif - -template <class _Value, class _Hash, class _Pred, class _Alloc> -bool -operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) -{ - if (__x.size() != __y.size()) - return false; - typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator - const_iterator; - typedef pair<const_iterator, const_iterator> _EqRng; - for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) - { - _EqRng __xeq = __x.equal_range(*__i); - _EqRng __yeq = __y.equal_range(*__i); - if (_VSTD::distance(__xeq.first, __xeq.second) != - _VSTD::distance(__yeq.first, __yeq.second) || - !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) - return false; - __i = __xeq.second; - } - return true; -} - -template <class _Value, class _Hash, class _Pred, class _Alloc> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) -{ - return !(__x == __y); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_UNORDERED_SET diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h b/contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h deleted file mode 100644 index c608202230..0000000000 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/unwind.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#if defined(__IOS__) -#include_next <unwind.h> -#else -#include <contrib/libs/cxxsupp/libcxxrt/unwind.h> -#endif |