diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-02-10 16:46:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:29 +0300 |
commit | f773626848a7c7456803654292e716b83d69cc12 (patch) | |
tree | db052dfcf9134f492bdbb962cb6c16cea58e1ed3 /contrib/libs/cxxsupp/libcxx/include/__utility | |
parent | f43ab775d197d300eb67bd4497632b909cd7c2a5 (diff) | |
download | ydb-f773626848a7c7456803654292e716b83d69cc12.tar.gz |
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__utility')
14 files changed, 1303 insertions, 1303 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h b/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h index 52da739875..b4c33d4a7f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h @@ -1,33 +1,33 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_AS_CONST_H -#define _LIBCPP___UTILITY_AS_CONST_H - -#include <__config> -#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 _LIBCPP_STD_VER > 14 -template <class _Tp> -_LIBCPP_NODISCARD_EXT constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } - -template <class _Tp> -void as_const(const _Tp&&) = delete; -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_AS_CONST_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_AS_CONST_H +#define _LIBCPP___UTILITY_AS_CONST_H + +#include <__config> +#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 _LIBCPP_STD_VER > 14 +template <class _Tp> +_LIBCPP_NODISCARD_EXT constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } + +template <class _Tp> +void as_const(const _Tp&&) = delete; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_AS_CONST_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h index 4fc96b054f..1b64b4c2bc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h @@ -1,110 +1,110 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_CMP_H -#define _LIBCPP___UTILITY_CMP_H - -#include <__config> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <limits> -#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 _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS) -template<class _Tp, class... _Up> -struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {}; - -template<class _Tp> -concept __is_safe_integral_cmp = is_integral_v<_Tp> && - !_IsSameAsAny<_Tp, bool, char -#ifndef _LIBCPP_HAS_NO_CHAR8_T - , char8_t -#endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - , char16_t, char32_t -#endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - , wchar_t -#endif - >::value; - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool cmp_equal(_Tp __t, _Up __u) noexcept -{ - if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) - return __t == __u; - else if constexpr (is_signed_v<_Tp>) - return __t < 0 ? false : make_unsigned_t<_Tp>(__t) == __u; - else - return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u); -} - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool cmp_not_equal(_Tp __t, _Up __u) noexcept -{ - return !_VSTD::cmp_equal(__t, __u); -} - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool cmp_less(_Tp __t, _Up __u) noexcept -{ - if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) - return __t < __u; - else if constexpr (is_signed_v<_Tp>) - return __t < 0 ? true : make_unsigned_t<_Tp>(__t) < __u; - else - return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u); -} - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool cmp_greater(_Tp __t, _Up __u) noexcept -{ - return _VSTD::cmp_less(__u, __t); -} - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool cmp_less_equal(_Tp __t, _Up __u) noexcept -{ - return !_VSTD::cmp_greater(__t, __u); -} - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool cmp_greater_equal(_Tp __t, _Up __u) noexcept -{ - return !_VSTD::cmp_less(__t, __u); -} - -template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> -_LIBCPP_INLINE_VISIBILITY constexpr -bool in_range(_Up __u) noexcept -{ - return _VSTD::cmp_less_equal(__u, numeric_limits<_Tp>::max()) && - _VSTD::cmp_greater_equal(__u, numeric_limits<_Tp>::min()); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___UTILITY_CMP_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_CMP_H +#define _LIBCPP___UTILITY_CMP_H + +#include <__config> +#include <__utility/forward.h> +#include <__utility/move.h> +#include <limits> +#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 _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS) +template<class _Tp, class... _Up> +struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {}; + +template<class _Tp> +concept __is_safe_integral_cmp = is_integral_v<_Tp> && + !_IsSameAsAny<_Tp, bool, char +#ifndef _LIBCPP_HAS_NO_CHAR8_T + , char8_t +#endif +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + , char16_t, char32_t +#endif +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + , wchar_t +#endif + >::value; + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool cmp_equal(_Tp __t, _Up __u) noexcept +{ + if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) + return __t == __u; + else if constexpr (is_signed_v<_Tp>) + return __t < 0 ? false : make_unsigned_t<_Tp>(__t) == __u; + else + return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u); +} + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool cmp_not_equal(_Tp __t, _Up __u) noexcept +{ + return !_VSTD::cmp_equal(__t, __u); +} + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool cmp_less(_Tp __t, _Up __u) noexcept +{ + if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) + return __t < __u; + else if constexpr (is_signed_v<_Tp>) + return __t < 0 ? true : make_unsigned_t<_Tp>(__t) < __u; + else + return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u); +} + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool cmp_greater(_Tp __t, _Up __u) noexcept +{ + return _VSTD::cmp_less(__u, __t); +} + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool cmp_less_equal(_Tp __t, _Up __u) noexcept +{ + return !_VSTD::cmp_greater(__t, __u); +} + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool cmp_greater_equal(_Tp __t, _Up __u) noexcept +{ + return !_VSTD::cmp_less(__t, __u); +} + +template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up> +_LIBCPP_INLINE_VISIBILITY constexpr +bool in_range(_Up __u) noexcept +{ + return _VSTD::cmp_less_equal(__u, numeric_limits<_Tp>::max()) && + _VSTD::cmp_greater_equal(__u, numeric_limits<_Tp>::min()); +} +#endif + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___UTILITY_CMP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/decay_copy.h b/contrib/libs/cxxsupp/libcxx/include/__utility/decay_copy.h index 1a7b399d91..0afba6bcea 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/decay_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/decay_copy.h @@ -1,34 +1,34 @@ -// -*- 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___UTILITY_DECAY_COPY_H -#define _LIBCPP___UTILITY_DECAY_COPY_H - -#include <__config> -#include <__utility/forward.h> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY typename decay<_Tp>::type __decay_copy(_Tp&& __t) -#if _LIBCPP_STD_VER > 17 - noexcept(is_nothrow_convertible_v<_Tp, remove_reference_t<_Tp> >) -#endif -{ - return _VSTD::forward<_Tp>(__t); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_DECAY_COPY_H +// -*- 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___UTILITY_DECAY_COPY_H +#define _LIBCPP___UTILITY_DECAY_COPY_H + +#include <__config> +#include <__utility/forward.h> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY typename decay<_Tp>::type __decay_copy(_Tp&& __t) +#if _LIBCPP_STD_VER > 17 + noexcept(is_nothrow_convertible_v<_Tp, remove_reference_t<_Tp> >) +#endif +{ + return _VSTD::forward<_Tp>(__t); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_DECAY_COPY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h b/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h index 873b0c3246..cee89c8bd1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h @@ -1,53 +1,53 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_DECLVAL_H -#define _LIBCPP___UTILITY_DECLVAL_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -// Suppress deprecation notice for volatile-qualified return type resulting -// from volatile-qualified types _Tp. -_LIBCPP_SUPPRESS_DEPRECATED_PUSH -template <class _Tp> -_Tp&& __declval(int); -template <class _Tp> -_Tp __declval(long); -_LIBCPP_SUPPRESS_DEPRECATED_POP - -#ifdef _LIBCPP_COMPILER_MSVC -template <class _Tp> -using __declval_void = void; - -template <class _Tp, class = void> -struct __declval_add_rvalue_reference { - using type = _Tp; -}; -template <class _Tp> -struct __declval_add_rvalue_reference<_Tp, __declval_void<_Tp&>> { - using type = _Tp&&; -}; -#endif - -template <class _Tp> -#ifdef _LIBCPP_COMPILER_MSVC -typename __declval_add_rvalue_reference<_Tp>::type -#else -decltype(__declval<_Tp>(0)) -#endif -declval() _NOEXCEPT; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_DECLVAL_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_DECLVAL_H +#define _LIBCPP___UTILITY_DECLVAL_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// Suppress deprecation notice for volatile-qualified return type resulting +// from volatile-qualified types _Tp. +_LIBCPP_SUPPRESS_DEPRECATED_PUSH +template <class _Tp> +_Tp&& __declval(int); +template <class _Tp> +_Tp __declval(long); +_LIBCPP_SUPPRESS_DEPRECATED_POP + +#ifdef _LIBCPP_COMPILER_MSVC +template <class _Tp> +using __declval_void = void; + +template <class _Tp, class = void> +struct __declval_add_rvalue_reference { + using type = _Tp; +}; +template <class _Tp> +struct __declval_add_rvalue_reference<_Tp, __declval_void<_Tp&>> { + using type = _Tp&&; +}; +#endif + +template <class _Tp> +#ifdef _LIBCPP_COMPILER_MSVC +typename __declval_add_rvalue_reference<_Tp>::type +#else +decltype(__declval<_Tp>(0)) +#endif +declval() _NOEXCEPT; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_DECLVAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h b/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h index f9c92c622f..8a3a892fb6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h @@ -1,37 +1,37 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_EXCHANGE_H -#define _LIBCPP___UTILITY_EXCHANGE_H - -#include <__config> -#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 _LIBCPP_STD_VER > 11 -template<class _T1, class _T2 = _T1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_T1 exchange(_T1& __obj, _T2&& __new_value) - noexcept(is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) -{ - _T1 __old_value = _VSTD::move(__obj); - __obj = _VSTD::forward<_T2>(__new_value); - return __old_value; -} -#endif // _LIBCPP_STD_VER > 11 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_EXCHANGE_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_EXCHANGE_H +#define _LIBCPP___UTILITY_EXCHANGE_H + +#include <__config> +#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 _LIBCPP_STD_VER > 11 +template<class _T1, class _T2 = _T1> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_T1 exchange(_T1& __obj, _T2&& __new_value) + noexcept(is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) +{ + _T1 __old_value = _VSTD::move(__obj); + __obj = _VSTD::forward<_T2>(__new_value); + return __old_value; +} +#endif // _LIBCPP_STD_VER > 11 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_EXCHANGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h index 7629a87d74..41b757a0b7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h @@ -1,37 +1,37 @@ -// -*- 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___UTILITY_FORWARD_H -#define _LIBCPP___UTILITY_FORWARD_H - -#include <__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& -forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT { - return static_cast<_Tp&&>(__t); -} - -template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& -forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT { - static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue"); - return static_cast<_Tp&&>(__t); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_FORWARD_H +// -*- 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___UTILITY_FORWARD_H +#define _LIBCPP___UTILITY_FORWARD_H + +#include <__config> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& +forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT { + return static_cast<_Tp&&>(__t); +} + +template <class _Tp> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& +forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT { + static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue"); + return static_cast<_Tp&&>(__t); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_FORWARD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h b/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h index 846b4a6d4d..35451f9cae 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h @@ -1,58 +1,58 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_IN_PLACE_H -#define _LIBCPP___UTILITY_IN_PLACE_H - -#include <__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER > 14 - -struct _LIBCPP_TYPE_VIS in_place_t { - explicit in_place_t() = default; -}; -inline constexpr in_place_t in_place{}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS in_place_type_t { - explicit in_place_type_t() = default; -}; -template <class _Tp> -inline constexpr in_place_type_t<_Tp> in_place_type{}; - -template <size_t _Idx> -struct _LIBCPP_TEMPLATE_VIS in_place_index_t { - explicit in_place_index_t() = default; -}; -template <size_t _Idx> -inline constexpr in_place_index_t<_Idx> in_place_index{}; - -template <class _Tp> struct __is_inplace_type_imp : false_type {}; -template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {}; - -template <class _Tp> -using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>; - -template <class _Tp> struct __is_inplace_index_imp : false_type {}; -template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {}; - -template <class _Tp> -using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>; - -#endif // _LIBCPP_STD_VER > 14 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_IN_PLACE_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_IN_PLACE_H +#define _LIBCPP___UTILITY_IN_PLACE_H + +#include <__config> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +struct _LIBCPP_TYPE_VIS in_place_t { + explicit in_place_t() = default; +}; +inline constexpr in_place_t in_place{}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS in_place_type_t { + explicit in_place_type_t() = default; +}; +template <class _Tp> +inline constexpr in_place_type_t<_Tp> in_place_type{}; + +template <size_t _Idx> +struct _LIBCPP_TEMPLATE_VIS in_place_index_t { + explicit in_place_index_t() = default; +}; +template <size_t _Idx> +inline constexpr in_place_index_t<_Idx> in_place_index{}; + +template <class _Tp> struct __is_inplace_type_imp : false_type {}; +template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {}; + +template <class _Tp> +using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>; + +template <class _Tp> struct __is_inplace_index_imp : false_type {}; +template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {}; + +template <class _Tp> +using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>; + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_IN_PLACE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h b/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h index 141f230763..4e8425338f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h @@ -1,94 +1,94 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_INTEGER_SEQUENCE_H -#define _LIBCPP___UTILITY_INTEGER_SEQUENCE_H - -#include <__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER > 11 - -template<class _Tp, _Tp... _Ip> -struct _LIBCPP_TEMPLATE_VIS integer_sequence -{ - typedef _Tp value_type; - static_assert( is_integral<_Tp>::value, - "std::integer_sequence can only be instantiated with an integral type" ); - static - _LIBCPP_INLINE_VISIBILITY - constexpr - size_t - size() noexcept { return sizeof...(_Ip); } -}; - -template<size_t... _Ip> - using index_sequence = integer_sequence<size_t, _Ip...>; - -#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) - -template <class _Tp, _Tp _Ep> -using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>; - -#else - -template <class _Tp, class _T> struct __integer_sequence_convert { - using type = integer_sequence<_Tp>; -}; - -template<class _Tp, class _Tp2, _Tp... _Values> -struct __integer_sequence_convert<_Tp, __integer_sequence<_Tp2, _Values...>> { - using type = integer_sequence<_Tp, _Values...>; -}; - -template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG = - typename __integer_sequence_convert<_Tp, typename __detail::__make<_Np>::type>::type; - -template <class _Tp, _Tp _Ep> -struct __make_integer_sequence_checked -{ - static_assert(is_integral<_Tp>::value, - "std::make_integer_sequence can only be instantiated with an integral type" ); - static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length"); -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning ( push ) -#pragma warning ( disable : 4296 ) -#endif - // Workaround GCC bug by preventing bad installations when 0 <= _Ep - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929 - typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type; -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning ( pop ) -#endif -}; - -template <class _Tp, _Tp _Ep> -using __make_integer_sequence _LIBCPP_NODEBUG = typename __make_integer_sequence_checked<_Tp, _Ep>::type; - -#endif - -template<class _Tp, _Tp _Np> - using make_integer_sequence = __make_integer_sequence<_Tp, _Np>; - -template<size_t _Np> - using make_index_sequence = make_integer_sequence<size_t, _Np>; - -template<class... _Tp> - using index_sequence_for = make_index_sequence<sizeof...(_Tp)>; - -#endif // _LIBCPP_STD_VER > 11 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_INTEGER_SEQUENCE_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_INTEGER_SEQUENCE_H +#define _LIBCPP___UTILITY_INTEGER_SEQUENCE_H + +#include <__config> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 11 + +template<class _Tp, _Tp... _Ip> +struct _LIBCPP_TEMPLATE_VIS integer_sequence +{ + typedef _Tp value_type; + static_assert( is_integral<_Tp>::value, + "std::integer_sequence can only be instantiated with an integral type" ); + static + _LIBCPP_INLINE_VISIBILITY + constexpr + size_t + size() noexcept { return sizeof...(_Ip); } +}; + +template<size_t... _Ip> + using index_sequence = integer_sequence<size_t, _Ip...>; + +#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) + +template <class _Tp, _Tp _Ep> +using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>; + +#else + +template <class _Tp, class _T> struct __integer_sequence_convert { + using type = integer_sequence<_Tp>; +}; + +template<class _Tp, class _Tp2, _Tp... _Values> +struct __integer_sequence_convert<_Tp, __integer_sequence<_Tp2, _Values...>> { + using type = integer_sequence<_Tp, _Values...>; +}; + +template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG = + typename __integer_sequence_convert<_Tp, typename __detail::__make<_Np>::type>::type; + +template <class _Tp, _Tp _Ep> +struct __make_integer_sequence_checked +{ + static_assert(is_integral<_Tp>::value, + "std::make_integer_sequence can only be instantiated with an integral type" ); + static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length"); +#ifdef _LIBCPP_COMPILER_MSVC +#pragma warning ( push ) +#pragma warning ( disable : 4296 ) +#endif + // Workaround GCC bug by preventing bad installations when 0 <= _Ep + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929 + typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type; +#ifdef _LIBCPP_COMPILER_MSVC +#pragma warning ( pop ) +#endif +}; + +template <class _Tp, _Tp _Ep> +using __make_integer_sequence _LIBCPP_NODEBUG = typename __make_integer_sequence_checked<_Tp, _Ep>::type; + +#endif + +template<class _Tp, _Tp _Np> + using make_integer_sequence = __make_integer_sequence<_Tp, _Np>; + +template<size_t _Np> + using make_index_sequence = make_integer_sequence<size_t, _Np>; + +template<class... _Tp> + using index_sequence_for = make_index_sequence<sizeof...(_Tp)>; + +#endif // _LIBCPP_STD_VER > 11 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_INTEGER_SEQUENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h index 75d715dc66..533dc2bda5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h @@ -1,47 +1,47 @@ -// -*- 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___UTILITY_MOVE_H -#define _LIBCPP___UTILITY_MOVE_H - -#include <__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename remove_reference<_Tp>::type&& -move(_Tp&& __t) _NOEXCEPT { - typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; - return static_cast<_Up&&>(__t); -} - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp> -using __move_if_noexcept_result_t = - typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, - _Tp&&>::type; -#else // _LIBCPP_CXX03_LANG -template <class _Tp> -using __move_if_noexcept_result_t = const _Tp&; -#endif - -template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> -move_if_noexcept(_Tp& __x) _NOEXCEPT { - return _VSTD::move(__x); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_MOVE_H +// -*- 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___UTILITY_MOVE_H +#define _LIBCPP___UTILITY_MOVE_H + +#include <__config> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename remove_reference<_Tp>::type&& +move(_Tp&& __t) _NOEXCEPT { + typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; + return static_cast<_Up&&>(__t); +} + +#ifndef _LIBCPP_CXX03_LANG +template <class _Tp> +using __move_if_noexcept_result_t = + typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, + _Tp&&>::type; +#else // _LIBCPP_CXX03_LANG +template <class _Tp> +using __move_if_noexcept_result_t = const _Tp&; +#endif + +template <class _Tp> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> +move_if_noexcept(_Tp& __x) _NOEXCEPT { + return _VSTD::move(__x); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_MOVE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h index 3a1ba8ab7c..6210813de3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h @@ -1,619 +1,619 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_PAIR_H -#define _LIBCPP___UTILITY_PAIR_H - -#include <__compare/common_comparison_category.h> -#include <__compare/synth_three_way.h> -#include <__config> -#include <__functional/unwrap_ref.h> -#include <__tuple> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <__utility/piecewise_construct.h> -#include <cstddef> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -template <class, class> -struct __non_trivially_copyable_base { - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - __non_trivially_copyable_base() _NOEXCEPT {} - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} -}; -#endif - -template <class _T1, class _T2> -struct _LIBCPP_TEMPLATE_VIS pair -#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -: private __non_trivially_copyable_base<_T1, _T2> -#endif -{ - typedef _T1 first_type; - typedef _T2 second_type; - - _T1 first; - _T2 second; - -#if !defined(_LIBCPP_CXX03_LANG) - pair(pair const&) = default; - pair(pair&&) = default; -#else - // Use the implicitly declared copy constructor in C++03 -#endif - -#ifdef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - pair() : first(), second() {} - - _LIBCPP_INLINE_VISIBILITY - pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {} - - template <class _U1, class _U2> - _LIBCPP_INLINE_VISIBILITY - pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} - - _LIBCPP_INLINE_VISIBILITY - pair& operator=(pair const& __p) { - first = __p.first; - second = __p.second; - return *this; - } -#else - template<bool _Dummy = true, int&... _Args> - struct _EnableImplicitDefaultConstructor { - static constexpr bool value = __is_implicitly_default_constructible<_T1>::value - && __is_implicitly_default_constructible<_T2>::value; - }; - - template<bool _Dummy = true, int&... _Args> - struct _EnableExplicitDefaultConstructor { - static constexpr bool value = is_default_constructible<_T1>::value - && is_default_constructible<_T2>::value - && !_EnableImplicitDefaultConstructor<_Dummy, _Args...>::value; - }; - - template <class _U1, class _U2, bool _Dummy = true> - struct _EnableExplicitConstructor { - static constexpr bool value = is_constructible<first_type, _U1>::value - && is_constructible<second_type, _U2>::value - && (!is_convertible<_U1, first_type>::value - || !is_convertible<_U2, second_type>::value); - }; - - template <class _U1, class _U2, bool _Dummy = true> - struct _EnableImplicitConstructor { - static constexpr bool value = is_constructible<first_type, _U1>::value - && is_constructible<second_type, _U2>::value - && is_convertible<_U1, first_type>::value - && is_convertible<_U2, second_type>::value; - }; - - template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value - && !is_same<typename decay<_Tuple>::type, pair>::value> - struct _EnableImplicitTupleLikeConstructor { - static constexpr bool value = false; - }; - - template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value - && !is_same<typename decay<_Tuple>::type, pair>::value> - struct _EnableExplicitTupleLikeConstructor { - static constexpr bool value = false; - }; - - template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value - && !is_same<typename decay<_Tuple>::type, pair>::value> - struct _EnableTupleLikeAssign { - static constexpr bool value = false; - }; - - template <class _Tuple> - struct _EnableImplicitTupleLikeConstructor<_Tuple, true> { - static constexpr bool value = __tuple_convertible<_Tuple, pair>::value; - }; - - template <class _Tuple> - struct _EnableExplicitTupleLikeConstructor<_Tuple, true> { - static constexpr bool value = __tuple_constructible<_Tuple, pair>::value - && !__tuple_convertible<_Tuple, pair>::value; - }; - - template <class _Tuple> - struct _EnableTupleLikeAssign<_Tuple, true> { - static constexpr bool value = __tuple_assignable<_Tuple, pair>::value; - }; - - template<bool _Dummy = true, typename enable_if< - _EnableExplicitDefaultConstructor<_Dummy>::value - >::type* = nullptr> - explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - pair() -// danlark@ if you remove this define, MSVC gets into ICE -#if !defined(_LIBCPP_COMPILER_MSVC) - _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && - is_nothrow_default_constructible<second_type>::value) -#endif - : first(), second() {} - - template<bool _Dummy = true, typename enable_if< - _EnableImplicitDefaultConstructor<_Dummy>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - pair() -// danlark@ if you remove this define, MSVC gets into ICE -#if !defined(_LIBCPP_COMPILER_MSVC) - _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && - is_nothrow_default_constructible<second_type>::value) -#endif - : first(), second() {} - - template <bool _Dummy = true, typename enable_if< - _EnableExplicitConstructor<_T1 const&, _T2 const&, _Dummy>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit pair(_T1 const& __t1, _T2 const& __t2) - _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && - is_nothrow_copy_constructible<second_type>::value) - : first(__t1), second(__t2) {} - - template<bool _Dummy = true, bool _Dummy2 = true, typename enable_if< - _EnableImplicitConstructor<_T1 const&, _T2 const&, _Dummy>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - pair(_T1 const& __t1, _T2 const& __t2) - _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && - is_nothrow_copy_constructible<second_type>::value) - : first(__t1), second(__t2) {} - - template < -#if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 - class _U1 = _T1, class _U2 = _T2, -#else - class _U1, class _U2, -#endif - typename enable_if<_EnableExplicitConstructor<_U1, _U2>::value>::type* = nullptr - > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit pair(_U1&& __u1, _U2&& __u2) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && - is_nothrow_constructible<second_type, _U2>::value)) - : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} - - template< -#if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 - class _U1 = _T1, class _U2 = _T2, -#else - class _U1, class _U2, -#endif - bool _Dummy = true, typename enable_if<_EnableImplicitConstructor<_U1, _U2, _Dummy>::value>::type* = nullptr - > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - pair(_U1&& __u1, _U2&& __u2) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && - is_nothrow_constructible<second_type, _U2>::value)) - : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} - - template<class _U1, class _U2, typename enable_if< - _EnableExplicitConstructor<_U1 const&, _U2 const&>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit pair(pair<_U1, _U2> const& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && - is_nothrow_constructible<second_type, _U2 const&>::value)) - : first(__p.first), second(__p.second) {} - - template<class _U1, class _U2, bool _Dummy = true, typename enable_if< - _EnableImplicitConstructor<_U1 const&, _U2 const&, _Dummy>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - pair(pair<_U1, _U2> const& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && - is_nothrow_constructible<second_type, _U2 const&>::value)) - : first(__p.first), second(__p.second) {} - - template<class _U1, class _U2, typename enable_if< - _EnableExplicitConstructor<_U1, _U2>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit pair(pair<_U1, _U2>&&__p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && - is_nothrow_constructible<second_type, _U2&&>::value)) - : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} - - template<class _U1, class _U2, bool _Dummy = true, typename enable_if< - _EnableImplicitConstructor<_U1, _U2>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - pair(pair<_U1, _U2>&& __p) - _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && - is_nothrow_constructible<second_type, _U2&&>::value)) - : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} - - template<class _Tuple, typename enable_if< - _EnableExplicitTupleLikeConstructor<_Tuple>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit pair(_Tuple&& __p) - : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), - second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} - - template<class _Tuple, bool _Dummy = true, typename enable_if< - _EnableImplicitTupleLikeConstructor<_Tuple>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - pair(_Tuple&& __p) - : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), - second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} - - template <class... _Args1, class... _Args2> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - pair(piecewise_construct_t __pc, - tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) - _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value && - is_nothrow_constructible<second_type, _Args2...>::value)) - : pair(__pc, __first_args, __second_args, - typename __make_tuple_indices<sizeof...(_Args1)>::type(), - typename __make_tuple_indices<sizeof...(_Args2) >::type()) {} - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - pair& operator=(typename conditional< - is_copy_assignable<first_type>::value && - is_copy_assignable<second_type>::value, - pair, __nat>::type const& __p) - _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value && - is_nothrow_copy_assignable<second_type>::value) - { - first = __p.first; - second = __p.second; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - pair& operator=(typename conditional< - is_move_assignable<first_type>::value && - is_move_assignable<second_type>::value, - pair, __nat>::type&& __p) - _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value && - is_nothrow_move_assignable<second_type>::value) - { - first = _VSTD::forward<first_type>(__p.first); - second = _VSTD::forward<second_type>(__p.second); - return *this; - } - - template <class _Tuple, bool _Dummy = true, typename enable_if< - _EnableTupleLikeAssign<_Tuple>::value - >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - pair& operator=(_Tuple&& __p) { - first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p)); - second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p)); - return *this; - } -#endif - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - void - swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value && - __is_nothrow_swappable<second_type>::value) - { - using _VSTD::swap; - swap(first, __p.first); - swap(second, __p.second); - } -private: - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - pair(piecewise_construct_t, - tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, - __tuple_indices<_I1...>, __tuple_indices<_I2...>); -#endif -}; - -#if _LIBCPP_STD_VER >= 17 -template<class _T1, class _T2> -pair(_T1, _T2) -> pair<_T1, _T2>; -#endif - -// [pairs.spec], specialized algorithms - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - return __x.first == __y.first && __x.second == __y.second; -} - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) - -template <class _T1, class _T2> -_LIBCPP_HIDE_FROM_ABI constexpr -common_comparison_category_t< - __synth_three_way_result<_T1>, - __synth_three_way_result<_T2> > -operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - if (auto __c = _VSTD::__synth_three_way(__x.first, __y.first); __c != 0) { - return __c; - } - return _VSTD::__synth_three_way(__x.second, __y.second); -} - -#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - return !(__x == __y); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - return __y < __x; -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - return !(__x < __y); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -bool -operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) -{ - return !(__y < __x); -} - -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename enable_if -< - __is_swappable<_T1>::value && - __is_swappable<_T2>::value, - void ->::type -swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) - _NOEXCEPT_((__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value)) -{ - __x.swap(__y); -} - -#ifndef _LIBCPP_CXX03_LANG - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> -make_pair(_T1&& __t1, _T2&& __t2) -{ - return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> - (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); -} - -#else // _LIBCPP_CXX03_LANG - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -pair<_T1,_T2> -make_pair(_T1 __x, _T2 __y) -{ - return pair<_T1, _T2>(__x, __y); -} - -#endif // _LIBCPP_CXX03_LANG - -template <class _T1, class _T2> - struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> > - : public integral_constant<size_t, 2> {}; - -template <size_t _Ip, class _T1, class _T2> -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > -{ - static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"); -}; - -template <class _T1, class _T2> -struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > -{ - typedef _LIBCPP_NODEBUG _T1 type; -}; - -template <class _T1, class _T2> -struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> > -{ - typedef _LIBCPP_NODEBUG _T2 type; -}; - -template <size_t _Ip> struct __get_pair; - -template <> -struct __get_pair<0> -{ - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - _T1& - get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} - - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - const _T1& - get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} - -#ifndef _LIBCPP_CXX03_LANG - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - _T1&& - get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);} - - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - const _T1&& - get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);} -#endif // _LIBCPP_CXX03_LANG -}; - -template <> -struct __get_pair<1> -{ - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - _T2& - get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} - - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - const _T2& - get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} - -#ifndef _LIBCPP_CXX03_LANG - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - _T2&& - get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);} - - template <class _T1, class _T2> - static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - const _T2&& - get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);} -#endif // _LIBCPP_CXX03_LANG -}; - -template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(pair<_T1, _T2>& __p) _NOEXCEPT -{ - return __get_pair<_Ip>::get(__p); -} - -template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(const pair<_T1, _T2>& __p) _NOEXCEPT -{ - return __get_pair<_Ip>::get(__p); -} - -#ifndef _LIBCPP_CXX03_LANG -template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(pair<_T1, _T2>&& __p) _NOEXCEPT -{ - return __get_pair<_Ip>::get(_VSTD::move(__p)); -} - -template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(const pair<_T1, _T2>&& __p) _NOEXCEPT -{ - return __get_pair<_Ip>::get(_VSTD::move(__p)); -} -#endif // _LIBCPP_CXX03_LANG - -#if _LIBCPP_STD_VER > 11 -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT -{ - return __get_pair<0>::get(__p); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT -{ - return __get_pair<0>::get(__p); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT -{ - return __get_pair<0>::get(_VSTD::move(__p)); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT -{ - return __get_pair<0>::get(_VSTD::move(__p)); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT -{ - return __get_pair<1>::get(__p); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT -{ - return __get_pair<1>::get(__p); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT -{ - return __get_pair<1>::get(_VSTD::move(__p)); -} - -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY -constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT -{ - return __get_pair<1>::get(_VSTD::move(__p)); -} - -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_PAIR_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_PAIR_H +#define _LIBCPP___UTILITY_PAIR_H + +#include <__compare/common_comparison_category.h> +#include <__compare/synth_three_way.h> +#include <__config> +#include <__functional/unwrap_ref.h> +#include <__tuple> +#include <__utility/forward.h> +#include <__utility/move.h> +#include <__utility/piecewise_construct.h> +#include <cstddef> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) +template <class, class> +struct __non_trivially_copyable_base { + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + __non_trivially_copyable_base() _NOEXCEPT {} + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} +}; +#endif + +template <class _T1, class _T2> +struct _LIBCPP_TEMPLATE_VIS pair +#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) +: private __non_trivially_copyable_base<_T1, _T2> +#endif +{ + typedef _T1 first_type; + typedef _T2 second_type; + + _T1 first; + _T2 second; + +#if !defined(_LIBCPP_CXX03_LANG) + pair(pair const&) = default; + pair(pair&&) = default; +#else + // Use the implicitly declared copy constructor in C++03 +#endif + +#ifdef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + pair() : first(), second() {} + + _LIBCPP_INLINE_VISIBILITY + pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {} + + template <class _U1, class _U2> + _LIBCPP_INLINE_VISIBILITY + pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} + + _LIBCPP_INLINE_VISIBILITY + pair& operator=(pair const& __p) { + first = __p.first; + second = __p.second; + return *this; + } +#else + template<bool _Dummy = true, int&... _Args> + struct _EnableImplicitDefaultConstructor { + static constexpr bool value = __is_implicitly_default_constructible<_T1>::value + && __is_implicitly_default_constructible<_T2>::value; + }; + + template<bool _Dummy = true, int&... _Args> + struct _EnableExplicitDefaultConstructor { + static constexpr bool value = is_default_constructible<_T1>::value + && is_default_constructible<_T2>::value + && !_EnableImplicitDefaultConstructor<_Dummy, _Args...>::value; + }; + + template <class _U1, class _U2, bool _Dummy = true> + struct _EnableExplicitConstructor { + static constexpr bool value = is_constructible<first_type, _U1>::value + && is_constructible<second_type, _U2>::value + && (!is_convertible<_U1, first_type>::value + || !is_convertible<_U2, second_type>::value); + }; + + template <class _U1, class _U2, bool _Dummy = true> + struct _EnableImplicitConstructor { + static constexpr bool value = is_constructible<first_type, _U1>::value + && is_constructible<second_type, _U2>::value + && is_convertible<_U1, first_type>::value + && is_convertible<_U2, second_type>::value; + }; + + template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value + && !is_same<typename decay<_Tuple>::type, pair>::value> + struct _EnableImplicitTupleLikeConstructor { + static constexpr bool value = false; + }; + + template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value + && !is_same<typename decay<_Tuple>::type, pair>::value> + struct _EnableExplicitTupleLikeConstructor { + static constexpr bool value = false; + }; + + template <class _Tuple, bool _Enable = __tuple_like_with_size<_Tuple, 2>::value + && !is_same<typename decay<_Tuple>::type, pair>::value> + struct _EnableTupleLikeAssign { + static constexpr bool value = false; + }; + + template <class _Tuple> + struct _EnableImplicitTupleLikeConstructor<_Tuple, true> { + static constexpr bool value = __tuple_convertible<_Tuple, pair>::value; + }; + + template <class _Tuple> + struct _EnableExplicitTupleLikeConstructor<_Tuple, true> { + static constexpr bool value = __tuple_constructible<_Tuple, pair>::value + && !__tuple_convertible<_Tuple, pair>::value; + }; + + template <class _Tuple> + struct _EnableTupleLikeAssign<_Tuple, true> { + static constexpr bool value = __tuple_assignable<_Tuple, pair>::value; + }; + + template<bool _Dummy = true, typename enable_if< + _EnableExplicitDefaultConstructor<_Dummy>::value + >::type* = nullptr> + explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + pair() +// danlark@ if you remove this define, MSVC gets into ICE +#if !defined(_LIBCPP_COMPILER_MSVC) + _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && + is_nothrow_default_constructible<second_type>::value) +#endif + : first(), second() {} + + template<bool _Dummy = true, typename enable_if< + _EnableImplicitDefaultConstructor<_Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + pair() +// danlark@ if you remove this define, MSVC gets into ICE +#if !defined(_LIBCPP_COMPILER_MSVC) + _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && + is_nothrow_default_constructible<second_type>::value) +#endif + : first(), second() {} + + template <bool _Dummy = true, typename enable_if< + _EnableExplicitConstructor<_T1 const&, _T2 const&, _Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(_T1 const& __t1, _T2 const& __t2) + _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && + is_nothrow_copy_constructible<second_type>::value) + : first(__t1), second(__t2) {} + + template<bool _Dummy = true, bool _Dummy2 = true, typename enable_if< + _EnableImplicitConstructor<_T1 const&, _T2 const&, _Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(_T1 const& __t1, _T2 const& __t2) + _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && + is_nothrow_copy_constructible<second_type>::value) + : first(__t1), second(__t2) {} + + template < +#if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 + class _U1 = _T1, class _U2 = _T2, +#else + class _U1, class _U2, +#endif + typename enable_if<_EnableExplicitConstructor<_U1, _U2>::value>::type* = nullptr + > + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(_U1&& __u1, _U2&& __u2) + _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && + is_nothrow_constructible<second_type, _U2>::value)) + : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} + + template< +#if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 + class _U1 = _T1, class _U2 = _T2, +#else + class _U1, class _U2, +#endif + bool _Dummy = true, typename enable_if<_EnableImplicitConstructor<_U1, _U2, _Dummy>::value>::type* = nullptr + > + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(_U1&& __u1, _U2&& __u2) + _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && + is_nothrow_constructible<second_type, _U2>::value)) + : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} + + template<class _U1, class _U2, typename enable_if< + _EnableExplicitConstructor<_U1 const&, _U2 const&>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(pair<_U1, _U2> const& __p) + _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && + is_nothrow_constructible<second_type, _U2 const&>::value)) + : first(__p.first), second(__p.second) {} + + template<class _U1, class _U2, bool _Dummy = true, typename enable_if< + _EnableImplicitConstructor<_U1 const&, _U2 const&, _Dummy>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(pair<_U1, _U2> const& __p) + _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && + is_nothrow_constructible<second_type, _U2 const&>::value)) + : first(__p.first), second(__p.second) {} + + template<class _U1, class _U2, typename enable_if< + _EnableExplicitConstructor<_U1, _U2>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(pair<_U1, _U2>&&__p) + _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && + is_nothrow_constructible<second_type, _U2&&>::value)) + : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} + + template<class _U1, class _U2, bool _Dummy = true, typename enable_if< + _EnableImplicitConstructor<_U1, _U2>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(pair<_U1, _U2>&& __p) + _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && + is_nothrow_constructible<second_type, _U2&&>::value)) + : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} + + template<class _Tuple, typename enable_if< + _EnableExplicitTupleLikeConstructor<_Tuple>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + explicit pair(_Tuple&& __p) + : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), + second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} + + template<class _Tuple, bool _Dummy = true, typename enable_if< + _EnableImplicitTupleLikeConstructor<_Tuple>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + pair(_Tuple&& __p) + : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), + second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} + + template <class... _Args1, class... _Args2> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + pair(piecewise_construct_t __pc, + tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) + _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value && + is_nothrow_constructible<second_type, _Args2...>::value)) + : pair(__pc, __first_args, __second_args, + typename __make_tuple_indices<sizeof...(_Args1)>::type(), + typename __make_tuple_indices<sizeof...(_Args2) >::type()) {} + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + pair& operator=(typename conditional< + is_copy_assignable<first_type>::value && + is_copy_assignable<second_type>::value, + pair, __nat>::type const& __p) + _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value && + is_nothrow_copy_assignable<second_type>::value) + { + first = __p.first; + second = __p.second; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + pair& operator=(typename conditional< + is_move_assignable<first_type>::value && + is_move_assignable<second_type>::value, + pair, __nat>::type&& __p) + _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value && + is_nothrow_move_assignable<second_type>::value) + { + first = _VSTD::forward<first_type>(__p.first); + second = _VSTD::forward<second_type>(__p.second); + return *this; + } + + template <class _Tuple, bool _Dummy = true, typename enable_if< + _EnableTupleLikeAssign<_Tuple>::value + >::type* = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + pair& operator=(_Tuple&& __p) { + first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p)); + second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p)); + return *this; + } +#endif + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + void + swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value && + __is_nothrow_swappable<second_type>::value) + { + using _VSTD::swap; + swap(first, __p.first); + swap(second, __p.second); + } +private: + +#ifndef _LIBCPP_CXX03_LANG + template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + pair(piecewise_construct_t, + tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, + __tuple_indices<_I1...>, __tuple_indices<_I2...>); +#endif +}; + +#if _LIBCPP_STD_VER >= 17 +template<class _T1, class _T2> +pair(_T1, _T2) -> pair<_T1, _T2>; +#endif + +// [pairs.spec], specialized algorithms + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +bool +operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + return __x.first == __y.first && __x.second == __y.second; +} + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) + +template <class _T1, class _T2> +_LIBCPP_HIDE_FROM_ABI constexpr +common_comparison_category_t< + __synth_three_way_result<_T1>, + __synth_three_way_result<_T2> > +operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + if (auto __c = _VSTD::__synth_three_way(__x.first, __y.first); __c != 0) { + return __c; + } + return _VSTD::__synth_three_way(__x.second, __y.second); +} + +#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + return !(__x == __y); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +bool +operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +bool +operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + return __y < __x; +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +bool +operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + return !(__x < __y); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +bool +operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +{ + return !(__y < __x); +} + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +typename enable_if +< + __is_swappable<_T1>::value && + __is_swappable<_T2>::value, + void +>::type +swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) + _NOEXCEPT_((__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value)) +{ + __x.swap(__y); +} + +#ifndef _LIBCPP_CXX03_LANG + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> +make_pair(_T1&& __t1, _T2&& __t2) +{ + return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> + (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); +} + +#else // _LIBCPP_CXX03_LANG + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +pair<_T1,_T2> +make_pair(_T1 __x, _T2 __y) +{ + return pair<_T1, _T2>(__x, __y); +} + +#endif // _LIBCPP_CXX03_LANG + +template <class _T1, class _T2> + struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> > + : public integral_constant<size_t, 2> {}; + +template <size_t _Ip, class _T1, class _T2> +struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > +{ + static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"); +}; + +template <class _T1, class _T2> +struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > +{ + typedef _LIBCPP_NODEBUG _T1 type; +}; + +template <class _T1, class _T2> +struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> > +{ + typedef _LIBCPP_NODEBUG _T2 type; +}; + +template <size_t _Ip> struct __get_pair; + +template <> +struct __get_pair<0> +{ + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + _T1& + get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} + + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const _T1& + get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} + +#ifndef _LIBCPP_CXX03_LANG + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + _T1&& + get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);} + + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const _T1&& + get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);} +#endif // _LIBCPP_CXX03_LANG +}; + +template <> +struct __get_pair<1> +{ + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + _T2& + get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} + + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const _T2& + get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} + +#ifndef _LIBCPP_CXX03_LANG + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + _T2&& + get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);} + + template <class _T1, class _T2> + static + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const _T2&& + get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);} +#endif // _LIBCPP_CXX03_LANG +}; + +template <size_t _Ip, class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +typename tuple_element<_Ip, pair<_T1, _T2> >::type& +get(pair<_T1, _T2>& __p) _NOEXCEPT +{ + return __get_pair<_Ip>::get(__p); +} + +template <size_t _Ip, class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +const typename tuple_element<_Ip, pair<_T1, _T2> >::type& +get(const pair<_T1, _T2>& __p) _NOEXCEPT +{ + return __get_pair<_Ip>::get(__p); +} + +#ifndef _LIBCPP_CXX03_LANG +template <size_t _Ip, class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +typename tuple_element<_Ip, pair<_T1, _T2> >::type&& +get(pair<_T1, _T2>&& __p) _NOEXCEPT +{ + return __get_pair<_Ip>::get(_VSTD::move(__p)); +} + +template <size_t _Ip, class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& +get(const pair<_T1, _T2>&& __p) _NOEXCEPT +{ + return __get_pair<_Ip>::get(_VSTD::move(__p)); +} +#endif // _LIBCPP_CXX03_LANG + +#if _LIBCPP_STD_VER > 11 +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT +{ + return __get_pair<0>::get(__p); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT +{ + return __get_pair<0>::get(__p); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT +{ + return __get_pair<0>::get(_VSTD::move(__p)); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT +{ + return __get_pair<0>::get(_VSTD::move(__p)); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT +{ + return __get_pair<1>::get(__p); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT +{ + return __get_pair<1>::get(__p); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT +{ + return __get_pair<1>::get(_VSTD::move(__p)); +} + +template <class _T1, class _T2> +inline _LIBCPP_INLINE_VISIBILITY +constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT +{ + return __get_pair<1>::get(_VSTD::move(__p)); +} + +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_PAIR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/piecewise_construct.h b/contrib/libs/cxxsupp/libcxx/include/__utility/piecewise_construct.h index 4dc44b38fe..6796b476aa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/piecewise_construct.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/piecewise_construct.h @@ -1,29 +1,29 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_PIECEWISE_CONSTRUCT_H -#define _LIBCPP___UTILITY_PIECEWISE_CONSTRUCT_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; }; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) -extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); -#else -/* inline */ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_PIECEWISE_CONSTRUCT_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_PIECEWISE_CONSTRUCT_H +#define _LIBCPP___UTILITY_PIECEWISE_CONSTRUCT_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; }; +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) +extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); +#else +/* inline */ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_PIECEWISE_CONSTRUCT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h index c94b8fddaf..2d1ebf20a8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h @@ -1,62 +1,62 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_REL_OPS_H -#define _LIBCPP___UTILITY_REL_OPS_H - -#include <__config> -#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 - -namespace rel_ops -{ - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const _Tp& __x, const _Tp& __y) -{ - return !(__x == __y); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator> (const _Tp& __x, const _Tp& __y) -{ - return __y < __x; -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<=(const _Tp& __x, const _Tp& __y) -{ - return !(__y < __x); -} - -template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -bool -operator>=(const _Tp& __x, const _Tp& __y) -{ - return !(__x < __y); -} - -} // rel_ops - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_REL_OPS_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_REL_OPS_H +#define _LIBCPP___UTILITY_REL_OPS_H + +#include <__config> +#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 + +namespace rel_ops +{ + +template<class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const _Tp& __x, const _Tp& __y) +{ + return !(__x == __y); +} + +template<class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +bool +operator> (const _Tp& __x, const _Tp& __y) +{ + return __y < __x; +} + +template<class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(const _Tp& __x, const _Tp& __y) +{ + return !(__y < __x); +} + +template<class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(const _Tp& __x, const _Tp& __y) +{ + return !(__x < __y); +} + +} // rel_ops + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_REL_OPS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h b/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h index 6c07511686..423c3e55b2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h @@ -1,50 +1,50 @@ -//===----------------------------------------------------------------------===// -// -// 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___UTILITY_SWAP_H -#define _LIBCPP___UTILITY_SWAP_H - -#include <__config> -#include <__utility/declval.h> -#include <__utility/move.h> -#include <type_traits> -#include <cstddef> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp> -using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type; -#else -template <class> -using __swap_result_t = void; -#endif - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_AFTER_CXX17 swap(_Tp& __x, _Tp& __y) - _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value) { - _Tp __t(_VSTD::move(__x)); - __x = _VSTD::move(__y); - __y = _VSTD::move(__t); -} - -template <class _Tp, size_t _Np> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if<__is_swappable<_Tp>::value>::type -swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { - for (size_t __i = 0; __i != _Np; ++__i) { - swap(__a[__i], __b[__i]); - } -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_SWAP_H +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_SWAP_H +#define _LIBCPP___UTILITY_SWAP_H + +#include <__config> +#include <__utility/declval.h> +#include <__utility/move.h> +#include <type_traits> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_CXX03_LANG +template <class _Tp> +using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type; +#else +template <class> +using __swap_result_t = void; +#endif + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_AFTER_CXX17 swap(_Tp& __x, _Tp& __y) + _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value) { + _Tp __t(_VSTD::move(__x)); + __x = _VSTD::move(__y); + __y = _VSTD::move(__t); +} + +template <class _Tp, size_t _Np> +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if<__is_swappable<_Tp>::value>::type +swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { + for (size_t __i = 0; __i != _Np; ++__i) { + swap(__a[__i], __b[__i]); + } +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_SWAP_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h b/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h index 084d3694e5..b4c38a1660 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h @@ -1,40 +1,40 @@ -// -*- C++ -*- -//===----------------- __utility/to_underlying.h --------------------------===// -// -// 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___UTILITY_TO_UNDERLYING_H -#define _LIBCPP___UTILITY_TO_UNDERLYING_H - -#include <__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr typename underlying_type<_Tp>::type -__to_underlying(_Tp __val) noexcept { - return static_cast<typename underlying_type<_Tp>::type>(__val); -} -#endif // !_LIBCPP_CXX03_LANG - -#if _LIBCPP_STD_VER > 20 -template <class _Tp> -_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY constexpr underlying_type_t<_Tp> -to_underlying(_Tp __val) noexcept { - return _VSTD::__to_underlying(__val); -} -#endif - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_TO_UNDERLYING_H +// -*- C++ -*- +//===----------------- __utility/to_underlying.h --------------------------===// +// +// 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___UTILITY_TO_UNDERLYING_H +#define _LIBCPP___UTILITY_TO_UNDERLYING_H + +#include <__config> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_CXX03_LANG +template <class _Tp> +_LIBCPP_INLINE_VISIBILITY constexpr typename underlying_type<_Tp>::type +__to_underlying(_Tp __val) noexcept { + return static_cast<typename underlying_type<_Tp>::type>(__val); +} +#endif // !_LIBCPP_CXX03_LANG + +#if _LIBCPP_STD_VER > 20 +template <class _Tp> +_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY constexpr underlying_type_t<_Tp> +to_underlying(_Tp __val) noexcept { + return _VSTD::__to_underlying(__val); +} +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_TO_UNDERLYING_H |