diff options
Diffstat (limited to 'contrib/llvm-project/libcxx/include/variant')
| -rw-r--r-- | contrib/llvm-project/libcxx/include/variant | 207 |
1 files changed, 105 insertions, 102 deletions
diff --git a/contrib/llvm-project/libcxx/include/variant b/contrib/llvm-project/libcxx/include/variant index 7df2e87cf3bf..3b01e5e126d9 100644 --- a/contrib/llvm-project/libcxx/include/variant +++ b/contrib/llvm-project/libcxx/include/variant @@ -278,7 +278,7 @@ struct __farray { static_assert(_Size > 0, "N-dimensional array should never be empty in std::visit"); _Tp __buf_[_Size] = {}; - _LIBCPP_INLINE_VISIBILITY constexpr + _LIBCPP_HIDE_FROM_ABI constexpr const _Tp &operator[](size_t __n) const noexcept { return __buf_[__n]; } @@ -370,27 +370,27 @@ template <class... _Types> class _LIBCPP_TEMPLATE_VIS variant; template <class... _Types> -_LIBCPP_INLINE_VISIBILITY constexpr variant<_Types...>& +_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>& __as_variant(variant<_Types...>& __vs) noexcept { return __vs; } template <class... _Types> -_LIBCPP_INLINE_VISIBILITY constexpr const variant<_Types...>& +_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>& __as_variant(const variant<_Types...>& __vs) noexcept { return __vs; } template <class... _Types> -_LIBCPP_INLINE_VISIBILITY constexpr variant<_Types...>&& +_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&& __as_variant(variant<_Types...>&& __vs) noexcept { - return _VSTD::move(__vs); + return std::move(__vs); } template <class... _Types> -_LIBCPP_INLINE_VISIBILITY constexpr const variant<_Types...>&& +_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&& __as_variant(const variant<_Types...>&& __vs) noexcept { - return _VSTD::move(__vs); + return std::move(__vs); } namespace __find_detail { @@ -482,13 +482,13 @@ struct __union { template <class _Vp> _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) { - return _VSTD::forward<_Vp>(__v).__head; + return std::forward<_Vp>(__v).__head; } template <class _Vp, size_t _Ip> _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) { - return __get_alt(_VSTD::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>); + return __get_alt(std::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>); } }; @@ -496,7 +496,7 @@ struct __base { template <size_t _Ip, class _Vp> _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) { - return __union::__get_alt(_VSTD::forward<_Vp>(__v).__data, + return __union::__get_alt(std::forward<_Vp>(__v).__data, in_place_index<_Ip>); } }; @@ -505,7 +505,7 @@ struct __variant { template <size_t _Ip, class _Vp> _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) { - return __base::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v).__impl_); + return __base::__get_alt<_Ip>(std::forward<_Vp>(__v).__impl_); } }; @@ -520,9 +520,9 @@ struct __base { __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { constexpr auto __fdiagonal = __make_fdiagonal<_Visitor&&, - decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>(); - return __fdiagonal[__index](_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs).__as_base()...); + decltype(std::forward<_Vs>(__vs).__as_base())...>(); + return __fdiagonal[__index](std::forward<_Visitor>(__visitor), + std::forward<_Vs>(__vs).__as_base()...); } template <class _Visitor, class... _Vs> @@ -531,10 +531,10 @@ struct __base { _Vs&&... __vs) { constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, - decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>(); + decltype(std::forward<_Vs>(__vs).__as_base())...>(); return __at(__fmatrix, __vs.index()...)( - _VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs).__as_base()...); + std::forward<_Visitor>(__visitor), + std::forward<_Vs>(__vs).__as_base()...); } private: @@ -561,7 +561,7 @@ private: static constexpr auto __make_farray(_Fs&&... __fs) { __std_visit_visitor_return_type_check<__remove_cvref_t<_Fs>...>(); using __result = __farray<common_type_t<__remove_cvref_t<_Fs>...>, sizeof...(_Fs)>; - return __result{{_VSTD::forward<_Fs>(__fs)...}}; + return __result{{std::forward<_Fs>(__fs)...}}; } template <size_t... _Is> @@ -569,7 +569,7 @@ private: template <class _Fp, class... _Vs> _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) { - return _VSTD::__invoke( + return std::__invoke( static_cast<_Fp>(__f), __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...); } @@ -631,8 +631,8 @@ struct __variant { static constexpr decltype(auto) __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { return __base::__visit_alt_at(__index, - _VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs).__impl_...); + std::forward<_Visitor>(__visitor), + std::forward<_Vs>(__vs).__impl_...); } template <class _Visitor, class... _Vs> @@ -640,8 +640,8 @@ struct __variant { static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) { return __base::__visit_alt( - _VSTD::forward<_Visitor>(__visitor), - _VSTD::__as_variant(_VSTD::forward<_Vs>(__vs)).__impl_...); + std::forward<_Visitor>(__visitor), + std::__as_variant(std::forward<_Vs>(__vs)).__impl_...); } template <class _Visitor, class... _Vs> @@ -650,8 +650,8 @@ struct __variant { __visit_value_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { return __visit_alt_at( __index, - __make_value_visitor(_VSTD::forward<_Visitor>(__visitor)), - _VSTD::forward<_Vs>(__vs)...); + __make_value_visitor(std::forward<_Visitor>(__visitor)), + std::forward<_Vs>(__vs)...); } template <class _Visitor, class... _Vs> @@ -659,8 +659,8 @@ struct __variant { static constexpr decltype(auto) __visit_value(_Visitor&& __visitor, _Vs&&... __vs) { return __visit_alt( - __make_value_visitor(_VSTD::forward<_Visitor>(__visitor)), - _VSTD::forward<_Vs>(__vs)...); + __make_value_visitor(std::forward<_Visitor>(__visitor)), + std::forward<_Vs>(__vs)...); } #if _LIBCPP_STD_VER >= 20 @@ -669,8 +669,8 @@ struct __variant { static constexpr _Rp __visit_value(_Visitor&& __visitor, _Vs&&... __vs) { return __visit_alt( - __make_value_visitor<_Rp>(_VSTD::forward<_Visitor>(__visitor)), - _VSTD::forward<_Vs>(__vs)...); + __make_value_visitor<_Rp>(std::forward<_Visitor>(__visitor)), + std::forward<_Vs>(__vs)...); } #endif @@ -688,9 +688,9 @@ private: constexpr decltype(auto) operator()(_Alts&&... __alts) const { __std_visit_exhaustive_visitor_check< _Visitor, - decltype((_VSTD::forward<_Alts>(__alts).__value))...>(); - return _VSTD::__invoke(_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Alts>(__alts).__value...); + decltype((std::forward<_Alts>(__alts).__value))...>(); + return std::__invoke(std::forward<_Visitor>(__visitor), + std::forward<_Alts>(__alts).__value...); } _Visitor&& __visitor; }; @@ -703,14 +703,14 @@ private: constexpr _Rp operator()(_Alts&&... __alts) const { __std_visit_exhaustive_visitor_check< _Visitor, - decltype((_VSTD::forward<_Alts>(__alts).__value))...>(); + decltype((std::forward<_Alts>(__alts).__value))...>(); if constexpr (is_void_v<_Rp>) { - _VSTD::__invoke(_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Alts>(__alts).__value...); + std::__invoke(std::forward<_Visitor>(__visitor), + std::forward<_Alts>(__alts).__value...); } else { - return _VSTD::__invoke(_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Alts>(__alts).__value...); + return std::__invoke(std::forward<_Visitor>(__visitor), + std::forward<_Alts>(__alts).__value...); } } @@ -721,14 +721,14 @@ private: template <class _Visitor> _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) { - return __value_visitor<_Visitor>{_VSTD::forward<_Visitor>(__visitor)}; + return __value_visitor<_Visitor>{std::forward<_Visitor>(__visitor)}; } #if _LIBCPP_STD_VER >= 20 template <class _Rp, class _Visitor> _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) { - return __value_visitor_return_type<_Rp, _Visitor>{_VSTD::forward<_Visitor>(__visitor)}; + return __value_visitor_return_type<_Rp, _Visitor>{std::forward<_Visitor>(__visitor)}; } #endif }; @@ -742,7 +742,7 @@ struct _LIBCPP_TEMPLATE_VIS __alt { template <class... _Args> _LIBCPP_HIDE_FROM_ABI explicit constexpr __alt(in_place_t, _Args&&... __args) - : __value(_VSTD::forward<_Args>(__args)...) {} + : __value(std::forward<_Args>(__args)...) {} __value_type __value; }; @@ -766,12 +766,12 @@ union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {}; template <class... _Args> \ _LIBCPP_HIDE_FROM_ABI \ explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \ - : __head(in_place, _VSTD::forward<_Args>(__args)...) {} \ + : __head(in_place, std::forward<_Args>(__args)...) {} \ \ template <size_t _Ip, class... _Args> \ _LIBCPP_HIDE_FROM_ABI \ explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \ - : __tail(in_place_index<_Ip - 1>, _VSTD::forward<_Args>(__args)...) {} \ + : __tail(in_place_index<_Ip - 1>, std::forward<_Args>(__args)...) {} \ \ __union(const __union&) = default; \ __union(__union&&) = default; \ @@ -808,7 +808,7 @@ public: _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args) : - __data(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...), + __data(in_place_index<_Ip>, std::forward<_Args>(__args)...), __index(_Ip) {} _LIBCPP_HIDE_FROM_ABI @@ -826,13 +826,13 @@ protected: constexpr auto&& __as_base() & { return *this; } _LIBCPP_HIDE_FROM_ABI - constexpr auto&& __as_base() && { return _VSTD::move(*this); } + constexpr auto&& __as_base() && { return std::move(*this); } _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const & { return *this; } _LIBCPP_HIDE_FROM_ABI - constexpr auto&& __as_base() const && { return _VSTD::move(*this); } + constexpr auto&& __as_base() const && { return std::move(*this); } _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Types); } @@ -909,8 +909,8 @@ protected: template <size_t _Ip, class _Tp, class... _Args> _LIBCPP_HIDE_FROM_ABI static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { - ::new ((void*)_VSTD::addressof(__a)) - __alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...); + ::new ((void*)std::addressof(__a)) + __alt<_Ip, _Tp>(in_place, std::forward<_Args>(__args)...); return __a.__value; } @@ -924,9 +924,9 @@ protected: [](auto& __lhs_alt, auto&& __rhs_alt) { __construct_alt( __lhs_alt, - _VSTD::forward<decltype(__rhs_alt)>(__rhs_alt).__value); + std::forward<decltype(__rhs_alt)>(__rhs_alt).__value); }, - __lhs, _VSTD::forward<_Rhs>(__rhs)); + __lhs, std::forward<_Rhs>(__rhs)); __lhs.__index = __rhs.index(); } } @@ -963,7 +963,7 @@ _LIBCPP_VARIANT_MOVE_CONSTRUCTOR( __move_constructor(__move_constructor&& __that) noexcept( __all<is_nothrow_move_constructible_v<_Types>...>::value) : __move_constructor(__valueless_t{}) { - this->__generic_construct(*this, _VSTD::move(__that)); + this->__generic_construct(*this, std::move(__that)); }); _LIBCPP_VARIANT_MOVE_CONSTRUCTOR( @@ -1024,7 +1024,7 @@ public: auto& __emplace(_Args&&... __args) { this->__destroy(); auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), - _VSTD::forward<_Args>(__args)...); + std::forward<_Args>(__args)...); this->__index = _Ip; return __res; } @@ -1034,18 +1034,18 @@ protected: _LIBCPP_HIDE_FROM_ABI void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) { if (this->index() == _Ip) { - __a.__value = _VSTD::forward<_Arg>(__arg); + __a.__value = std::forward<_Arg>(__arg); } else { struct { _LIBCPP_HIDE_FROM_ABI void operator()(true_type) const { - __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); + __this->__emplace<_Ip>(std::forward<_Arg>(__arg)); } _LIBCPP_HIDE_FROM_ABI void operator()(false_type) const { - __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); + __this->__emplace<_Ip>(_Tp(std::forward<_Arg>(__arg))); } __assignment* __this; _Arg&& __arg; - } __impl{this, _VSTD::forward<_Arg>(__arg)}; + } __impl{this, std::forward<_Arg>(__arg)}; __impl(bool_constant<is_nothrow_constructible_v<_Tp, _Arg> || !is_nothrow_move_constructible_v<_Tp>>{}); } @@ -1064,9 +1064,9 @@ protected: [this](auto& __this_alt, auto&& __that_alt) { this->__assign_alt( __this_alt, - _VSTD::forward<decltype(__that_alt)>(__that_alt).__value); + std::forward<decltype(__that_alt)>(__that_alt).__value); }, - *this, _VSTD::forward<_That>(__that)); + *this, std::forward<_That>(__that)); } } }; @@ -1102,7 +1102,7 @@ _LIBCPP_VARIANT_MOVE_ASSIGNMENT( __move_assignment& operator=(__move_assignment&& __that) noexcept( __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_move_assignable_v<_Types>)...>::value) { - this->__generic_assign(_VSTD::move(__that)); + this->__generic_assign(std::move(__that)); return *this; }); @@ -1167,7 +1167,7 @@ public: _LIBCPP_HIDE_FROM_ABI void __assign(_Arg&& __arg) { this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), - _VSTD::forward<_Arg>(__arg)); + std::forward<_Arg>(__arg)); } inline _LIBCPP_HIDE_FROM_ABI @@ -1178,30 +1178,30 @@ public: __visitation::__base::__visit_alt_at( this->index(), [](auto& __this_alt, auto& __that_alt) { - using _VSTD::swap; + using std::swap; swap(__this_alt.__value, __that_alt.__value); }, *this, __that); } else { __impl* __lhs = this; - __impl* __rhs = _VSTD::addressof(__that); + __impl* __rhs = std::addressof(__that); if (__lhs->__move_nothrow() && !__rhs->__move_nothrow()) { - _VSTD::swap(__lhs, __rhs); + std::swap(__lhs, __rhs); } - __impl __tmp(_VSTD::move(*__rhs)); + __impl __tmp(std::move(*__rhs)); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS if constexpr (__all<is_nothrow_move_constructible_v<_Types>...>::value) { - this->__generic_construct(*__rhs, _VSTD::move(*__lhs)); + this->__generic_construct(*__rhs, std::move(*__lhs)); } else { // EXTENSION: When the move construction of `__lhs` into `__rhs` throws // and `__tmp` is nothrow move constructible then we move `__tmp` back // into `__rhs` and provide the strong exception safety guarantee. try { - this->__generic_construct(*__rhs, _VSTD::move(*__lhs)); + this->__generic_construct(*__rhs, std::move(*__lhs)); } catch (...) { if (__tmp.__move_nothrow()) { - this->__generic_construct(*__rhs, _VSTD::move(__tmp)); + this->__generic_construct(*__rhs, std::move(__tmp)); } throw; } @@ -1209,9 +1209,9 @@ public: #else // this isn't consolidated with the `if constexpr` branch above due to // `throw` being ill-formed with exceptions disabled even when discarded. - this->__generic_construct(*__rhs, _VSTD::move(*__lhs)); + this->__generic_construct(*__rhs, std::move(*__lhs)); #endif - this->__generic_construct(*__lhs, _VSTD::move(__tmp)); + this->__generic_construct(*__lhs, std::move(__tmp)); } } @@ -1252,6 +1252,8 @@ struct __overload { auto operator()(_Tp, _Up&&) const -> __check_for_narrowing<_Tp, _Up>; }; +// TODO(LLVM-19): Remove all occurrences of this macro. +#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT template <class _Tp, size_t> struct __overload_bool { template <class _Up, class _Ap = __remove_cvref_t<_Up>> @@ -1267,6 +1269,7 @@ template <size_t _Idx> struct __overload<bool volatile, _Idx> : __overload_bool<bool volatile, _Idx> {}; template <size_t _Idx> struct __overload<bool const volatile, _Idx> : __overload_bool<bool const volatile, _Idx> {}; +#endif template <class ..._Bases> struct __all_overloads : _Bases... { @@ -1341,7 +1344,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr variant(_Arg&& __arg) noexcept( is_nothrow_constructible_v<_Tp, _Arg>) - : __impl_(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} + : __impl_(in_place_index<_Ip>, std::forward<_Arg>(__arg)) {} template <size_t _Ip, class... _Args, class = enable_if_t<(_Ip < sizeof...(_Types)), int>, @@ -1351,7 +1354,7 @@ public: explicit constexpr variant( in_place_index_t<_Ip>, _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) - : __impl_(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} + : __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {} template < size_t _Ip, @@ -1367,7 +1370,7 @@ public: initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) - : __impl_(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} + : __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {} template < class _Tp, @@ -1378,7 +1381,7 @@ public: _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, _Args...>) - : __impl_(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} + : __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {} template < class _Tp, @@ -1394,7 +1397,7 @@ public: initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>) - : __impl_(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} + : __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {} _LIBCPP_HIDE_FROM_ABI ~variant() = default; @@ -1413,7 +1416,7 @@ public: variant& operator=(_Arg&& __arg) noexcept( is_nothrow_assignable_v<_Tp&, _Arg> && is_nothrow_constructible_v<_Tp, _Arg>) { - __impl_.template __assign<_Ip>(_VSTD::forward<_Arg>(__arg)); + __impl_.template __assign<_Ip>(std::forward<_Arg>(__arg)); return *this; } @@ -1425,7 +1428,7 @@ public: enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) { - return __impl_.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); + return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...); } template < @@ -1438,7 +1441,7 @@ public: int> = 0> _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { - return __impl_.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); + return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...); } template < @@ -1449,7 +1452,7 @@ public: enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0> _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) { - return __impl_.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); + return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...); } template < @@ -1462,7 +1465,7 @@ public: int> = 0> _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { - return __impl_.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); + return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...); } _LIBCPP_HIDE_FROM_ABI @@ -1514,7 +1517,7 @@ constexpr auto&& __generic_get(_Vp&& __v) { if (!std::__holds_alternative<_Ip>(__v)) { __throw_bad_variant_access(); } - return __variant::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v)).__value; + return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value; } template <size_t _Ip, class... _Types> @@ -1534,7 +1537,7 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get( variant<_Types...>&& __v) { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); - return std::__generic_get<_Ip>(_VSTD::move(__v)); + return std::__generic_get<_Ip>(std::move(__v)); } template <size_t _Ip, class... _Types> @@ -1554,7 +1557,7 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get( const variant<_Types...>&& __v) { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>); - return std::__generic_get<_Ip>(_VSTD::move(__v)); + return std::__generic_get<_Ip>(std::move(__v)); } template <class _Tp, class... _Types> @@ -1562,7 +1565,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp& get(variant<_Types...>& __v) { static_assert(!is_void_v<_Tp>); - return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); + return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template <class _Tp, class... _Types> @@ -1570,8 +1573,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp&& get(variant<_Types...>&& __v) { static_assert(!is_void_v<_Tp>); - return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>( - _VSTD::move(__v)); + return std::get<__find_exactly_one_t<_Tp, _Types...>::value>( + std::move(__v)); } template <class _Tp, class... _Types> @@ -1579,7 +1582,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp& get(const variant<_Types...>& __v) { static_assert(!is_void_v<_Tp>); - return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); + return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template <class _Tp, class... _Types> @@ -1587,8 +1590,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&& get(const variant<_Types...>&& __v) { static_assert(!is_void_v<_Tp>); - return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>( - _VSTD::move(__v)); + return std::get<__find_exactly_one_t<_Tp, _Types...>::value>( + std::move(__v)); } template <size_t _Ip, class _Vp> @@ -1596,7 +1599,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto* __generic_get_if(_Vp* __v) noexcept { using __variant_detail::__access::__variant; return __v && std::__holds_alternative<_Ip>(*__v) - ? _VSTD::addressof(__variant::__get_alt<_Ip>(*__v).__value) + ? std::addressof(__variant::__get_alt<_Ip>(*__v).__value) : nullptr; } @@ -1623,7 +1626,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept { static_assert(!is_void_v<_Tp>); - return _VSTD::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v); + return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template <class _Tp, class... _Types> @@ -1631,7 +1634,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __v) noexcept { static_assert(!is_void_v<_Tp>); - return _VSTD::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v); + return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template <class _Operator> @@ -1639,9 +1642,9 @@ struct __convert_to_bool { template <class _T1, class _T2> _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_T1 && __t1, _T2&& __t2) const { - static_assert(is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value, + static_assert(is_convertible<decltype(_Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2))), bool>::value, "the relational operator does not return a type which is implicitly convertible to bool"); - return _Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); + return _Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2)); } }; @@ -1742,7 +1745,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void __throw_if_valueless(_Vs&&... __vs) { const bool __valueless = - (... || _VSTD::__as_variant(__vs).valueless_by_exception()); + (... || std::__as_variant(__vs).valueless_by_exception()); if (__valueless) { __throw_bad_variant_access(); } @@ -1750,27 +1753,27 @@ constexpr void __throw_if_valueless(_Vs&&... __vs) { template < class _Visitor, class... _Vs, - typename = void_t<decltype(_VSTD::__as_variant(std::declval<_Vs>()))...> > + typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { using __variant_detail::__visitation::__variant; - _VSTD::__throw_if_valueless(_VSTD::forward<_Vs>(__vs)...); - return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs)...); + std::__throw_if_valueless(std::forward<_Vs>(__vs)...); + return __variant::__visit_value(std::forward<_Visitor>(__visitor), + std::forward<_Vs>(__vs)...); } #if _LIBCPP_STD_VER >= 20 template < class _Rp, class _Visitor, class... _Vs, - typename = void_t<decltype(_VSTD::__as_variant(std::declval<_Vs>()))...> > + typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp visit(_Visitor&& __visitor, _Vs&&... __vs) { using __variant_detail::__visitation::__variant; - _VSTD::__throw_if_valueless(_VSTD::forward<_Vs>(__vs)...); - return __variant::__visit_value<_Rp>(_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs)...); + std::__throw_if_valueless(std::forward<_Vs>(__vs)...); + return __variant::__visit_value<_Rp>(std::forward<_Visitor>(__visitor), + std::forward<_Vs>(__vs)...); } #endif @@ -1812,7 +1815,7 @@ template <size_t _Ip, class _Vp> _LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(_Vp&& __v) noexcept { using __variant_detail::__access::__variant; - return __variant::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v)).__value; + return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value; } template <class _Tp, class... _Types> |
