diff options
author | armenqa <armenqa@yandex-team.com> | 2024-01-19 12:23:50 +0300 |
---|---|---|
committer | armenqa <armenqa@yandex-team.com> | 2024-01-19 13:10:03 +0300 |
commit | 2de0149d0151c514b22bca0760b95b26c9b0b578 (patch) | |
tree | 2bfed9f3bce7e643ddf048bb61ce3dc0a714bcc2 /contrib/libs/cxxsupp/libcxx/include/optional | |
parent | a8c06d218f12b2406fbce24d194885c5d7b68503 (diff) | |
download | ydb-2de0149d0151c514b22bca0760b95b26c9b0b578.tar.gz |
feat contrib: aiogram 3
Relates: https://st.yandex-team.ru/, https://st.yandex-team.ru/
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/optional')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/optional | 123 |
1 files changed, 64 insertions, 59 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index 39b9f25db5..41c003cdb6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -87,8 +87,8 @@ namespace std { // 23.6.3.1, constructors constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; - optional(const optional &); - optional(optional &&) noexcept(see below); + constexpr optional(const optional &); + constexpr optional(optional &&) noexcept(see below); template <class... Args> constexpr explicit optional(in_place_t, Args &&...); template <class U, class... Args> constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...); @@ -104,8 +104,8 @@ namespace std { // 23.6.3.3, assignment optional &operator=(nullopt_t) noexcept; // constexpr in C++20 - optional &operator=(const optional &); // constexpr in C++20 - optional &operator=(optional &&) noexcept(see below); // constexpr in C++20 + constexpr optional &operator=(const optional &); + constexpr optional &operator=(optional &&) noexcept(see below); template <class U = T> optional &operator=(U &&); // constexpr in C++20 template <class U> optional &operator=(const optional<U> &); // constexpr in C++20 template <class U> optional &operator=(optional<U> &&); // constexpr in C++20 @@ -166,7 +166,7 @@ template<class T> #include <__functional/invoke.h> #include <__functional/unary_function.h> #include <__memory/construct_at.h> -#include <__tuple> +#include <__tuple/sfinae_helpers.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> @@ -177,22 +177,9 @@ template<class T> #include <type_traits> #include <version> -#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES -# include <atomic> -# include <chrono> -# include <climits> -# include <concepts> -# include <ctime> -# include <iterator> -# include <memory> -# include <ratio> -# include <tuple> -# include <typeinfo> -# include <utility> -# include <variant> -#endif - // standard-mandated includes + +// [optional.syn] #include <compare> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -207,8 +194,8 @@ class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optiona { public: // Get the key function ~bad_optional_access() into the dylib - virtual ~bad_optional_access() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_optional_access() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; } // namespace std @@ -255,7 +242,7 @@ struct __optional_destruct_base<_Tp, false> bool __engaged_; _LIBCPP_INLINE_VISIBILITY - /* _LIBCPP_CONSTEXPR_AFTER_CXX17 */ ~__optional_destruct_base() + ~__optional_destruct_base() { if (__engaged_) __val_.~value_type(); @@ -280,7 +267,7 @@ struct __optional_destruct_base<_Tp, false> #endif _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void reset() noexcept + _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { if (__engaged_) { @@ -322,7 +309,7 @@ struct __optional_destruct_base<_Tp, true> #endif _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void reset() noexcept + _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { if (__engaged_) { @@ -367,7 +354,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> template <class... _Args> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct(_Args&&... __args) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) { _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); #if _LIBCPP_STD_VER > 17 @@ -380,7 +367,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> template <class _That> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_from(_That&& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) { if (__opt.has_value()) __construct(_VSTD::forward<_That>(__opt).__get()); @@ -388,7 +375,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> template <class _That> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void __assign_from(_That&& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) { if (this->__engaged_ == __opt.has_value()) { @@ -417,14 +404,14 @@ struct __optional_storage_base<_Tp, true> template <class _Up> static constexpr bool __can_bind_reference() { - using _RawUp = typename remove_reference<_Up>::type; + using _RawUp = __libcpp_remove_reference_t<_Up>; using _UpPtr = _RawUp*; - using _RawTp = typename remove_reference<_Tp>::type; + using _RawTp = __libcpp_remove_reference_t<_Tp>; using _TpPtr = _RawTp*; using _CheckLValueArg = integral_constant<bool, (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) || is_same<_RawUp, reference_wrapper<_RawTp>>::value - || is_same<_RawUp, reference_wrapper<typename remove_const<_RawTp>::type>>::value + || is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value >; return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) || (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value && @@ -446,7 +433,7 @@ struct __optional_storage_base<_Tp, true> } _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void reset() noexcept { __value_ = nullptr; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; } _LIBCPP_INLINE_VISIBILITY constexpr bool has_value() const noexcept @@ -462,7 +449,7 @@ struct __optional_storage_base<_Tp, true> template <class _UArg> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct(_UArg&& __val) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) { _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); static_assert(__can_bind_reference<_UArg>(), @@ -473,7 +460,7 @@ struct __optional_storage_base<_Tp, true> template <class _That> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_from(_That&& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) { if (__opt.has_value()) __construct(_VSTD::forward<_That>(__opt).__get()); @@ -481,7 +468,7 @@ struct __optional_storage_base<_Tp, true> template <class _That> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void __assign_from(_That&& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) { if (has_value() == __opt.has_value()) { @@ -513,7 +500,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> __optional_copy_base() = default; _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_copy_base(const __optional_copy_base& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt) { this->__construct_from(__opt); } @@ -544,7 +531,7 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> __optional_move_base(const __optional_move_base&) = default; _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_move_base(__optional_move_base&& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_base(__optional_move_base&& __opt) noexcept(is_nothrow_move_constructible_v<value_type>) { this->__construct_from(_VSTD::move(__opt)); @@ -578,7 +565,7 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> __optional_copy_assign_base(__optional_copy_assign_base&&) = default; _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt) { this->__assign_from(__opt); return *this; @@ -613,7 +600,7 @@ struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default; _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt) noexcept(is_nothrow_move_assignable_v<value_type> && is_nothrow_move_constructible_v<value_type>) { @@ -652,9 +639,9 @@ public: private: // Disable the reference extension using this static assert. - static_assert(!is_same_v<__uncvref_t<value_type>, in_place_t>, + static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>, "instantiation of optional with in_place_t is ill-formed"); - static_assert(!is_same_v<__uncvref_t<value_type>, nullopt_t>, + static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed"); static_assert(!is_reference_v<value_type>, "instantiation of optional with a reference type is ill-formed"); @@ -679,8 +666,8 @@ private: }; template <class _Up> using _CheckOptionalArgsCtor = _If< - _IsNotSame<__uncvref_t<_Up>, in_place_t>::value && - _IsNotSame<__uncvref_t<_Up>, optional>::value, + _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value && + _IsNotSame<__remove_cvref_t<_Up>, optional>::value, _CheckOptionalArgsConstructor, __check_tuple_constructor_fail >; @@ -787,7 +774,7 @@ public: _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 optional(const optional<_Up>& __v) + _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) { this->__construct_from(__v); } @@ -795,7 +782,7 @@ public: _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit optional(const optional<_Up>& __v) + _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) { this->__construct_from(__v); } @@ -805,7 +792,7 @@ public: _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 optional(optional<_Up>&& __v) + _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) { this->__construct_from(_VSTD::move(__v)); } @@ -813,7 +800,7 @@ public: _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit optional(optional<_Up>&& __v) + _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) { this->__construct_from(_VSTD::move(__v)); } @@ -827,22 +814,22 @@ public: #endif _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& operator=(nullopt_t) noexcept + _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept { reset(); return *this; } - _LIBCPP_INLINE_VISIBILITY optional& operator=(const optional&) = default; - _LIBCPP_INLINE_VISIBILITY optional& operator=(optional&&) = default; + constexpr optional& operator=(const optional&) = default; + constexpr optional& operator=(optional&&) = default; // LWG2756 template <class _Up = value_type, class = enable_if_t< _And< - _IsNotSame<__uncvref_t<_Up>, optional>, + _IsNotSame<__remove_cvref_t<_Up>, optional>, _Or< - _IsNotSame<__uncvref_t<_Up>, value_type>, + _IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>> >, is_constructible<value_type, _Up>, @@ -850,7 +837,7 @@ public: >::value> > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& + _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) { if (this->has_value()) @@ -865,7 +852,7 @@ public: _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& + _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(const optional<_Up>& __v) { this->__assign_from(__v); @@ -877,7 +864,7 @@ public: _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 optional& + _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(optional<_Up>&& __v) { this->__assign_from(_VSTD::move(__v)); @@ -891,7 +878,7 @@ public: > > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp & + _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & emplace(_Args&&... __args) { reset(); @@ -906,7 +893,7 @@ public: > > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp & + _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); @@ -915,7 +902,7 @@ public: } _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(optional& __opt) + _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt) noexcept(is_nothrow_move_constructible_v<value_type> && is_nothrow_swappable_v<value_type>) { @@ -1535,7 +1522,7 @@ operator>=(const _Tp& __v, const optional<_Up>& __x) template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void @@ -1587,4 +1574,22 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 14 +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include <chrono> +#endif + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <climits> +# include <concepts> +# include <ctime> +# include <iterator> +# include <memory> +# include <ratio> +# include <tuple> +# include <typeinfo> +# include <utility> +# include <variant> +#endif + #endif // _LIBCPP_OPTIONAL |