diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index a6867fb30a37..1dbeb213f8ba 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -1,212 +1,214 @@ .. _FeatureTestMacroTable: ========================== Feature Test Macro Support ========================== .. contents:: :local: Overview ======== This file documents the feature test macros currently supported by libc++. .. _feature-status: Status ====== .. table:: Current Status :name: feature-status-table :widths: auto ================================================= ================= Macro Name Value ================================================= ================= **C++ 14** ------------------------------------------------------------------- ``__cpp_lib_chrono_udls`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_complex_udls`` ``201309L`` ------------------------------------------------- ----------------- ``__cpp_lib_exchange_function`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_generic_associative_lookup`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_integer_sequence`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_integral_constant_callable`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_is_final`` ``201402L`` ------------------------------------------------- ----------------- ``__cpp_lib_is_null_pointer`` ``201309L`` ------------------------------------------------- ----------------- ``__cpp_lib_make_reverse_iterator`` ``201402L`` ------------------------------------------------- ----------------- ``__cpp_lib_make_unique`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_null_iterators`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_quoted_string_io`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_result_of_sfinae`` ``201210L`` ------------------------------------------------- ----------------- ``__cpp_lib_robust_nonmodifying_seq_ops`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_shared_timed_mutex`` ``201402L`` ------------------------------------------------- ----------------- ``__cpp_lib_string_udls`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_transformation_trait_aliases`` ``201304L`` ------------------------------------------------- ----------------- ``__cpp_lib_transparent_operators`` ``201210L`` ------------------------------------------------- ----------------- ``__cpp_lib_tuple_element_t`` ``201402L`` ------------------------------------------------- ----------------- ``__cpp_lib_tuples_by_type`` ``201304L`` ------------------------------------------------- ----------------- **C++ 17** ------------------------------------------------------------------- ``__cpp_lib_addressof_constexpr`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_allocator_traits_is_always_equal`` ``201411L`` ------------------------------------------------- ----------------- ``__cpp_lib_any`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_apply`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_array_constexpr`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_as_const`` ``201510L`` ------------------------------------------------- ----------------- ``__cpp_lib_atomic_is_always_lock_free`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_bool_constant`` ``201505L`` ------------------------------------------------- ----------------- ``__cpp_lib_boyer_moore_searcher`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_byte`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_chrono`` ``201611L`` ------------------------------------------------- ----------------- ``__cpp_lib_clamp`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_enable_shared_from_this`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_execution`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_filesystem`` ``201703L`` ------------------------------------------------- ----------------- ``__cpp_lib_gcd_lcm`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_hardware_interference_size`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_has_unique_object_representations`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_hypot`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_incomplete_container_elements`` ``201505L`` ------------------------------------------------- ----------------- ``__cpp_lib_invoke`` ``201411L`` ------------------------------------------------- ----------------- ``__cpp_lib_is_aggregate`` ``201703L`` ------------------------------------------------- ----------------- ``__cpp_lib_is_invocable`` ``201703L`` ------------------------------------------------- ----------------- ``__cpp_lib_is_swappable`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_launder`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_logical_traits`` ``201510L`` ------------------------------------------------- ----------------- ``__cpp_lib_make_from_tuple`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_map_try_emplace`` ``201411L`` ------------------------------------------------- ----------------- ``__cpp_lib_math_special_functions`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_memory_resource`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_node_extract`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_nonmember_container_access`` ``201411L`` ------------------------------------------------- ----------------- ``__cpp_lib_not_fn`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_optional`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_parallel_algorithm`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_raw_memory_algorithms`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_sample`` ``201603L`` ------------------------------------------------- ----------------- ``__cpp_lib_scoped_lock`` ``201703L`` ------------------------------------------------- ----------------- ``__cpp_lib_shared_mutex`` ``201505L`` ------------------------------------------------- ----------------- ``__cpp_lib_shared_ptr_arrays`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_shared_ptr_weak_type`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_string_view`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_to_chars`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_transparent_operators`` ``201510L`` ------------------------------------------------- ----------------- ``__cpp_lib_type_trait_variable_templates`` ``201510L`` ------------------------------------------------- ----------------- ``__cpp_lib_uncaught_exceptions`` ``201411L`` ------------------------------------------------- ----------------- ``__cpp_lib_unordered_map_try_emplace`` ``201411L`` ------------------------------------------------- ----------------- ``__cpp_lib_variant`` ``201606L`` ------------------------------------------------- ----------------- ``__cpp_lib_void_t`` ``201411L`` ------------------------------------------------- ----------------- **C++ 2a** ------------------------------------------------------------------- ``__cpp_lib_array_constexpr`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_atomic_ref`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_bind_front`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_bit_cast`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_char8_t`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_concepts`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_constexpr_misc`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_constexpr_swap_algorithms`` *unimplemented* ------------------------------------------------- ----------------- + ``__cpp_lib_constexpr_utility `` ``201811L`` + ------------------------------------------------- ----------------- ``__cpp_lib_destroying_delete`` ``201806L`` ------------------------------------------------- ----------------- ``__cpp_lib_endian`` ``201907L`` ------------------------------------------------- ----------------- ``__cpp_lib_erase_if`` ``202002L`` ------------------------------------------------- ----------------- ``__cpp_lib_generic_unordered_lookup`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_interpolate`` ``201902L`` ------------------------------------------------- ----------------- ``__cpp_lib_is_constant_evaluated`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_list_remove_return_type`` ``201806L`` ------------------------------------------------- ----------------- ``__cpp_lib_math_constants`` ``201907L`` ------------------------------------------------- ----------------- ``__cpp_lib_ranges`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_span`` ``202002L`` ------------------------------------------------- ----------------- ``__cpp_lib_three_way_comparison`` *unimplemented* ------------------------------------------------- ----------------- ``__cpp_lib_to_array`` ``201907L`` ================================================= ================= diff --git a/libcxx/include/tuple b/libcxx/include/tuple index 1f80b70759c7..c3c7db5ff118 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -1,1453 +1,1453 @@ // -*- C++ -*- //===--------------------------- tuple ------------------------------------===// // // 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_TUPLE #define _LIBCPP_TUPLE /* tuple synopsis namespace std { template class tuple { public: explicit(see-below) constexpr tuple(); explicit(see-below) tuple(const T&...); // constexpr in C++14 template explicit(see-below) tuple(U&&...); // constexpr in C++14 tuple(const tuple&) = default; tuple(tuple&&) = default; template explicit(see-below) tuple(const tuple&); // constexpr in C++14 template explicit(see-below) tuple(tuple&&); // constexpr in C++14 template explicit(see-below) tuple(const pair&); // iff sizeof...(T) == 2 // constexpr in C++14 template explicit(see-below) tuple(pair&&); // iff sizeof...(T) == 2 // constexpr in C++14 // allocator-extended constructors template tuple(allocator_arg_t, const Alloc& a); template explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const T&...); template explicit(see-below) tuple(allocator_arg_t, const Alloc& a, U&&...); template tuple(allocator_arg_t, const Alloc& a, const tuple&); template tuple(allocator_arg_t, const Alloc& a, tuple&&); template explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple&); template explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple&&); template explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair&); template explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair&&); tuple& operator=(const tuple&); tuple& operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable::value ...)); template tuple& operator=(const tuple&); template tuple& operator=(tuple&&); template tuple& operator=(const pair&); // iff sizeof...(T) == 2 template tuple& operator=(pair&&); // iff sizeof...(T) == 2 void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); }; template tuple(T...) -> tuple; // since C++17 template tuple(pair) -> tuple; // since C++17 template tuple(allocator_arg_t, Alloc, T...) -> tuple; // since C++17 template tuple(allocator_arg_t, Alloc, pair) -> tuple; // since C++17 template tuple(allocator_arg_t, Alloc, tuple) -> tuple; // since C++17 inline constexpr unspecified ignore; template tuple make_tuple(T&&...); // constexpr in C++14 template tuple forward_as_tuple(T&&...) noexcept; // constexpr in C++14 template tuple tie(T&...) noexcept; // constexpr in C++14 template tuple tuple_cat(Tuples&&... tpls); // constexpr in C++14 // [tuple.apply], calling a function with a tuple of arguments: template constexpr decltype(auto) apply(F&& f, Tuple&& t); // C++17 template constexpr T make_from_tuple(Tuple&& t); // C++17 // 20.4.1.4, tuple helper classes: template struct tuple_size; // undefined template struct tuple_size>; template inline constexpr size_t tuple_size_v = tuple_size::value; // C++17 template struct tuple_element; // undefined template struct tuple_element>; template using tuple_element_t = typename tuple_element ::type; // C++14 // 20.4.1.5, element access: template typename tuple_element>::type& get(tuple&) noexcept; // constexpr in C++14 template const typename tuple_element>::type& get(const tuple&) noexcept; // constexpr in C++14 template typename tuple_element>::type&& get(tuple&&) noexcept; // constexpr in C++14 template const typename tuple_element>::type&& get(const tuple&&) noexcept; // constexpr in C++14 template constexpr T1& get(tuple&) noexcept; // C++14 template constexpr const T1& get(const tuple&) noexcept; // C++14 template constexpr T1&& get(tuple&&) noexcept; // C++14 template constexpr const T1&& get(const tuple&&) noexcept; // C++14 // 20.4.1.6, relational operators: template bool operator==(const tuple&, const tuple&); // constexpr in C++14 template bool operator<(const tuple&, const tuple&); // constexpr in C++14 template bool operator!=(const tuple&, const tuple&); // constexpr in C++14 template bool operator>(const tuple&, const tuple&); // constexpr in C++14 template bool operator<=(const tuple&, const tuple&); // constexpr in C++14 template bool operator>=(const tuple&, const tuple&); // constexpr in C++14 template struct uses_allocator, Alloc>; template void swap(tuple& x, tuple& y) noexcept(noexcept(x.swap(y))); } // std */ #include <__config> #include <__tuple> #include #include #include <__functional_base> #include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_CXX03_LANG // __tuple_leaf template ::value && !__libcpp_is_final<_Hp>::value > class __tuple_leaf; template inline _LIBCPP_INLINE_VISIBILITY void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) { swap(__x.get(), __y.get()); } template class __tuple_leaf { _Hp __value_; template static constexpr bool __can_bind_reference() { #if __has_keyword(__reference_binds_to_temporary) return !__reference_binds_to_temporary(_Hp, _Tp); #else return true; #endif } __tuple_leaf& operator=(const __tuple_leaf&); public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : __value_(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : __value_(__a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template , __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp&&>(), "Attempted construction of reference element binds to a temporary whose lifetime has ended");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp&&>(), "Attempted construction of reference element binds to a temporary whose lifetime has ended");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : __value_(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} __tuple_leaf(const __tuple_leaf& __t) = default; __tuple_leaf(__tuple_leaf&& __t) = default; template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { __value_ = _VSTD::forward<_Tp>(__t); return *this; } _LIBCPP_INLINE_VISIBILITY int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { _VSTD::swap(*this, __t); return 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} }; template class __tuple_leaf<_Ip, _Hp, true> : private _Hp { __tuple_leaf& operator=(const __tuple_leaf&); public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : _Hp(allocator_arg_t(), __a) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : _Hp(__a) {} template , __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : _Hp(_VSTD::forward<_Tp>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t), __a) {} __tuple_leaf(__tuple_leaf const &) = default; __tuple_leaf(__tuple_leaf &&) = default; template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { _Hp::operator=(_VSTD::forward<_Tp>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { _VSTD::swap(*this, __t); return 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast(*this);} }; template _LIBCPP_INLINE_VISIBILITY void __swallow(_Tp&&...) _NOEXCEPT {} template struct __all_default_constructible; template struct __all_default_constructible<__tuple_types<_Tp...>> : __all::value...> { }; // __tuple_impl template struct __tuple_impl; template struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... { _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_impl() _NOEXCEPT_(__all::value...>::value) {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) _NOEXCEPT_((__all::value...>::value && __all::value...>::value)) : __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_impl(allocator_arg_t, const _Alloc& __a, __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, _VSTD::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {} template >::value >::type > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) : __tuple_leaf<_Indx, _Tp>(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))... {} template >::value >::type > _LIBCPP_INLINE_VISIBILITY __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(), __a, _VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))... {} template _LIBCPP_INLINE_VISIBILITY typename enable_if < __tuple_assignable<_Tuple, tuple<_Tp...> >::value, __tuple_impl& >::type operator=(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))...); return *this; } __tuple_impl(const __tuple_impl&) = default; __tuple_impl(__tuple_impl&&) = default; _LIBCPP_INLINE_VISIBILITY __tuple_impl& operator=(const __tuple_impl& __t) _NOEXCEPT_((__all::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); return *this; } _LIBCPP_INLINE_VISIBILITY __tuple_impl& operator=(__tuple_impl&& __t) _NOEXCEPT_((__all::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(__tuple_impl& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) { __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); } }; template class _LIBCPP_TEMPLATE_VIS tuple { typedef __tuple_impl::type, _Tp...> _BaseT; _BaseT __base_; #if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION) static constexpr bool _EnableImplicitReducedArityExtension = true; #else static constexpr bool _EnableImplicitReducedArityExtension = false; #endif template struct _PackExpandsToThisTuple : false_type {}; template struct _PackExpandsToThisTuple<_Arg> : is_same::type, tuple> {}; template struct _CheckArgsConstructor : __check_tuple_constructor_fail {}; template struct _CheckArgsConstructor { template static constexpr bool __enable_implicit_default() { return __all<__is_implicitly_default_constructible<_Tp>::value... >::value; } template static constexpr bool __enable_explicit_default() { return __all::value...>::value && !__enable_implicit_default< >(); } template static constexpr bool __enable_explicit() { return __tuple_constructible< tuple<_Args...>, typename __make_tuple_types::type >::value && !__tuple_convertible< tuple<_Args...>, typename __make_tuple_types::type >::value && __all_default_constructible< typename __make_tuple_types::type >::value; } template static constexpr bool __enable_implicit() { return __tuple_constructible< tuple<_Args...>, typename __make_tuple_types::type >::value && __tuple_convertible< tuple<_Args...>, typename __make_tuple_types::type >::value && __all_default_constructible< typename __make_tuple_types::type >::value; } }; template struct _CheckTupleLikeConstructor : __check_tuple_constructor_fail {}; template struct _CheckTupleLikeConstructor { template static constexpr bool __enable_implicit() { return __tuple_constructible<_Tuple, tuple>::value && __tuple_convertible<_Tuple, tuple>::value; } template static constexpr bool __enable_explicit() { return __tuple_constructible<_Tuple, tuple>::value && !__tuple_convertible<_Tuple, tuple>::value; } }; template struct _CheckTupleLikeConstructor { // This trait is used to disable the tuple-like constructor when // the UTypes... constructor should be selected instead. // See LWG issue #2549. template using _PreferTupleLikeConstructor = _Or< // Don't attempt the two checks below if the tuple we are given // has the same type as this tuple. _IsSame<__uncvref_t<_Tuple>, tuple>, _Lazy<_And, _Not>, _Not> > >; template static constexpr bool __enable_implicit() { return _And< __tuple_constructible<_Tuple, tuple>, __tuple_convertible<_Tuple, tuple>, _PreferTupleLikeConstructor<_Tuple> >::value; } template static constexpr bool __enable_explicit() { return _And< __tuple_constructible<_Tuple, tuple>, _PreferTupleLikeConstructor<_Tuple>, _Not<__tuple_convertible<_Tuple, tuple>> >::value; } }; template using _EnableImplicitTupleLikeConstructor = _EnableIf< _CheckTupleLikeConstructor< __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value && !_PackExpandsToThisTuple<_Tuple>::value && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue) >::template __enable_implicit<_Tuple>(), bool >; template using _EnableExplicitTupleLikeConstructor = _EnableIf< _CheckTupleLikeConstructor< __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value && !_PackExpandsToThisTuple<_Tuple>::value && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue) >::template __enable_explicit<_Tuple>(), bool >; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT; public: template ::__enable_implicit_default() , void*> = nullptr> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all::value...>::value) {} template ::__enable_explicit_default() , void*> = nullptr> explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all::value...>::value) {} tuple(tuple const&) = default; tuple(tuple&&) = default; template ::value >::__enable_implicit_default() , void*> = nullptr > _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices::type(), __tuple_types<_Tp...>()) {} template ::value>::__enable_explicit_default() , void*> = nullptr > explicit _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices::type(), __tuple_types<_Tp...>()) {} template ::template __enable_implicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::template __enable_explicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::template __enable_implicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::template __enable_explicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::value, typename enable_if < _CheckArgsConstructor< sizeof...(_Up) == sizeof...(_Tp) && !_PackIsTuple >::template __enable_implicit<_Up...>() || _CheckArgsConstructor< _EnableImplicitReducedArityExtension && sizeof...(_Up) < sizeof...(_Tp) && !_PackIsTuple >::template __enable_implicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Up&&... __u) _NOEXCEPT_(( is_nothrow_constructible<_BaseT, typename __make_tuple_indices::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, typename __make_tuple_types::type, _Up... >::value )) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value >::template __enable_explicit<_Up...>() || _CheckArgsConstructor< !_EnableImplicitReducedArityExtension && sizeof...(_Up) < sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_implicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(_Up&&... __u) _NOEXCEPT_(( is_nothrow_constructible<_BaseT, typename __make_tuple_indices::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, typename __make_tuple_types::type, _Up... >::value )) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value >::template __enable_implicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value >::template __enable_explicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) : __base_(_VSTD::forward<_Tuple>(__t)) {} template = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tuple& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, const _Tuple&>::value)) : __base_(__t) {} template = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) : __base_(_VSTD::forward<_Tuple>(__t)) {} template = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tuple& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, const _Tuple&>::value)) : __base_(__t) {} template ::value >::template __enable_implicit<_Tuple>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} template ::value >::template __enable_explicit<_Tuple>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all::value...>; using _CanMoveAssign = __all::value...>; _LIBCPP_INLINE_VISIBILITY tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all::value...>::value)) { __base_.operator=(__t.__base_); return *this; } _LIBCPP_INLINE_VISIBILITY tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) _NOEXCEPT_((__all::value...>::value)) { __base_.operator=(static_cast<_BaseT&&>(__t.__base_)); return *this; } template ::value >::type > _LIBCPP_INLINE_VISIBILITY tuple& operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value)) { __base_.operator=(_VSTD::forward<_Tuple>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__base_.swap(__t.__base_);} }; template <> class _LIBCPP_TEMPLATE_VIS tuple<> { public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR tuple() _NOEXCEPT = default; template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(array<_Up, 0>) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void swap(tuple&) _NOEXCEPT {} }; #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES template tuple(_Tp...) -> tuple<_Tp...>; template tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>; template tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>; template tuple(allocator_arg_t, _Alloc, pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>; template tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>; #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < __all<__is_swappable<_Tp>::value...>::value, void >::type swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__t.swap(__u);} // get template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast&>(__t.__base_).get(); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( static_cast&&>(__t.__base_).get()); } #if _LIBCPP_STD_VER > 11 namespace __find_detail { static constexpr size_t __not_found = -1; static constexpr size_t __ambiguous = __not_found - 1; inline _LIBCPP_INLINE_VISIBILITY constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) { return !__matches ? __res : (__res == __not_found ? __curr_i : __ambiguous); } template inline _LIBCPP_INLINE_VISIBILITY constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) { return __i == _Nx ? __not_found : __find_idx_return(__i, __find_idx(__i + 1, __matches), __matches[__i]); } template struct __find_exactly_one_checked { static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, _Args>::value...}; static constexpr size_t value = __find_detail::__find_idx(0, __matches); static_assert(value != __not_found, "type not found in type list" ); static_assert(value != __ambiguous, "type occurs more than once in type list"); }; template struct __find_exactly_one_checked<_T1> { static_assert(!is_same<_T1, _T1>::value, "type not in empty type list"); }; } // namespace __find_detail; template struct __find_exactly_one_t : public __find_detail::__find_exactly_one_checked<_T1, _Args...> { }; template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1& get(tuple<_Args...>& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup)); } #endif // tie template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT { return tuple<_Tp&...>(__t...); } template struct __ignore_t { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const __ignore_t& operator=(_Tp&&) const {return *this;} }; namespace { _LIBCPP_INLINE_VAR constexpr __ignore_t ignore = __ignore_t(); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple::type...> make_tuple(_Tp&&... __t) { return tuple::type...>(_VSTD::forward<_Tp>(__t)...); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT { return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...); } template struct __tuple_equal { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp& __x, const _Up& __y) { return __tuple_equal<_Ip - 1>()(__x, __y) && _VSTD::get<_Ip-1>(__x) == _VSTD::get<_Ip-1>(__y); } }; template <> struct __tuple_equal<0> { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp&, const _Up&) { return true; } }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes"); return __tuple_equal()(__x, __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__x == __y); } template struct __tuple_less { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp& __x, const _Up& __y) { const size_t __idx = tuple_size<_Tp>::value - _Ip; if (_VSTD::get<__idx>(__x) < _VSTD::get<__idx>(__y)) return true; if (_VSTD::get<__idx>(__y) < _VSTD::get<__idx>(__x)) return false; return __tuple_less<_Ip-1>()(__x, __y); } }; template <> struct __tuple_less<0> { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp&, const _Up&) { return false; } }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes"); return __tuple_less()(__x, __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return __y < __x; } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__x < __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__y < __x); } // tuple_cat template struct __tuple_cat_type; template struct __tuple_cat_type, __tuple_types<_Utypes...> > { typedef _LIBCPP_NODEBUG_TYPE tuple<_Ttypes..., _Utypes...> type; }; template struct __tuple_cat_return_1 { }; template struct __tuple_cat_return_1, true, _Tuple0> { typedef _LIBCPP_NODEBUG_TYPE typename __tuple_cat_type, typename __make_tuple_types::type>::type>::type type; }; template struct __tuple_cat_return_1, true, _Tuple0, _Tuple1, _Tuples...> : public __tuple_cat_return_1< typename __tuple_cat_type< tuple<_Types...>, typename __make_tuple_types::type>::type >::type, __tuple_like::type>::value, _Tuple1, _Tuples...> { }; template struct __tuple_cat_return; template struct __tuple_cat_return<_Tuple0, _Tuples...> : public __tuple_cat_return_1, __tuple_like::type>::value, _Tuple0, _Tuples...> { }; template <> struct __tuple_cat_return<> { typedef _LIBCPP_NODEBUG_TYPE tuple<> type; }; inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<> tuple_cat() { return tuple<>(); } template struct __tuple_cat_return_ref_imp; template struct __tuple_cat_return_ref_imp, __tuple_indices<_I0...>, _Tuple0> { typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0; typedef tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_I0, _T0>::type>::type&&...> type; }; template struct __tuple_cat_return_ref_imp, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...> : public __tuple_cat_return_ref_imp< tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_I0, typename remove_reference<_Tuple0>::type>::type>::type&&...>, typename __make_tuple_indices::type>::value>::type, _Tuple1, _Tuples...> { }; template struct __tuple_cat_return_ref : public __tuple_cat_return_ref_imp, typename __make_tuple_indices< tuple_size::type>::value >::type, _Tuple0, _Tuples...> { }; template struct __tuple_cat; template struct __tuple_cat, __tuple_indices<_I0...>, __tuple_indices<_J0...> > { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename __tuple_cat_return_ref&&, _Tuple0&&>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0) { return _VSTD::forward_as_tuple( _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); } template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename __tuple_cat_return_ref&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls) { typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0; typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1; return __tuple_cat< tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element< _J0, _T0>::type>::type&&...>, typename __make_tuple_indices::value>::type, typename __make_tuple_indices::value>::type>()( _VSTD::forward_as_tuple( _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...), _VSTD::forward<_Tuple1>(__t1), _VSTD::forward<_Tuples>(__tpls)...); } }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename __tuple_cat_return<_Tuple0, _Tuples...>::type tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) { typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0; return __tuple_cat, __tuple_indices<>, typename __make_tuple_indices::value>::type>() (tuple<>(), _VSTD::forward<_Tuple0>(__t0), _VSTD::forward<_Tuples>(__tpls)...); } template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _Alloc> : true_type {}; template template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_T1, _T2>::pair(piecewise_construct_t, tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) : first(_VSTD::forward<_Args1>(_VSTD::get<_I1>( __first_args))...), second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) { } #if _LIBCPP_STD_VER > 14 template _LIBCPP_INLINE_VAR constexpr size_t tuple_size_v = tuple_size<_Tp>::value; #define _LIBCPP_NOEXCEPT_RETURN(...) noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; } template inline _LIBCPP_INLINE_VISIBILITY constexpr decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t, __tuple_indices<_Id...>) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__invoke_constexpr( _VSTD::forward<_Fn>(__f), _VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))...) ) template inline _LIBCPP_INLINE_VISIBILITY constexpr decltype(auto) apply(_Fn && __f, _Tuple && __t) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__apply_tuple_impl( _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t), typename __make_tuple_indices>>::type{}) ) template inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>) _LIBCPP_NOEXCEPT_RETURN( _Tp(_VSTD::get<_Idx>(_VSTD::forward<_Tuple>(__t))...) ) template inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__make_from_tuple_impl<_Tp>(_VSTD::forward<_Tuple>(__t), typename __make_tuple_indices>>::type{}) ) #undef _LIBCPP_NOEXCEPT_RETURN #endif // _LIBCPP_STD_VER > 14 #endif // !defined(_LIBCPP_CXX03_LANG) _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_TUPLE diff --git a/libcxx/include/utility b/libcxx/include/utility index 7ac322bfe710..13489de22c95 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -1,1619 +1,1619 @@ // -*- C++ -*- //===-------------------------- utility -----------------------------------===// // // 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 #define _LIBCPP_UTILITY /* utility synopsis #include namespace std { template void swap(T& a, T& b); namespace rel_ops { template bool operator!=(const T&, const T&); template bool operator> (const T&, const T&); template bool operator<=(const T&, const T&); template bool operator>=(const T&, const T&); } template void swap(T& a, T& b) noexcept(is_nothrow_move_constructible::value && is_nothrow_move_assignable::value); template void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b))); template T&& forward(typename remove_reference::type& t) noexcept; // constexpr in C++14 template T&& forward(typename remove_reference::type&& t) noexcept; // constexpr in C++14 template typename remove_reference::type&& move(T&&) noexcept; // constexpr in C++14 template typename conditional < !is_nothrow_move_constructible::value && is_copy_constructible::value, const T&, T&& >::type move_if_noexcept(T& x) noexcept; // constexpr in C++14 template constexpr add_const_t& as_const(T& t) noexcept; // C++17 template void as_const(const T&&) = delete; // C++17 template typename add_rvalue_reference::type declval() noexcept; template struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair(const pair&) = default; pair(pair&&) = default; explicit(see-below) constexpr pair(); explicit(see-below) pair(const T1& x, const T2& y); // constexpr in C++14 template explicit(see-below) pair(U&& x, V&& y); // constexpr in C++14 template explicit(see-below) pair(const pair& p); // constexpr in C++14 template explicit(see-below) pair(pair&& p); // constexpr in C++14 template pair(piecewise_construct_t, tuple first_args, tuple second_args); template pair& operator=(const pair& p); pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable::value && is_nothrow_move_assignable::value); template pair& operator=(pair&& p); void swap(pair& p) noexcept(is_nothrow_swappable_v && is_nothrow_swappable_v); }; template bool operator==(const pair&, const pair&); // constexpr in C++14 template bool operator!=(const pair&, const pair&); // constexpr in C++14 template bool operator< (const pair&, const pair&); // constexpr in C++14 template bool operator> (const pair&, const pair&); // constexpr in C++14 template bool operator>=(const pair&, const pair&); // constexpr in C++14 template bool operator<=(const pair&, const pair&); // constexpr in C++14 template pair make_pair(T1&&, T2&&); // constexpr in C++14 template void swap(pair& x, pair& y) noexcept(noexcept(x.swap(y))); struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); template struct tuple_size; template struct tuple_element; template struct tuple_size >; template struct tuple_element<0, pair >; template struct tuple_element<1, pair >; template typename tuple_element >::type& get(pair&) noexcept; // constexpr in C++14 template const typename tuple_element >::type& get(const pair&) noexcept; // constexpr in C++14 template typename tuple_element >::type&& get(pair&&) noexcept; // constexpr in C++14 template const typename tuple_element >::type&& get(const pair&&) noexcept; // constexpr in C++14 template constexpr T1& get(pair&) noexcept; // C++14 template constexpr const T1& get(const pair&) noexcept; // C++14 template constexpr T1&& get(pair&&) noexcept; // C++14 template constexpr const T1&& get(const pair&&) noexcept; // C++14 template constexpr T1& get(pair&) noexcept; // C++14 template constexpr const T1& get(const pair&) noexcept; // C++14 template constexpr T1&& get(pair&&) noexcept; // C++14 template constexpr const T1&& get(const pair&&) noexcept; // C++14 // C++14 template struct integer_sequence { typedef T value_type; static constexpr size_t size() noexcept; }; template using index_sequence = integer_sequence; template using make_integer_sequence = integer_sequence; template using make_index_sequence = make_integer_sequence; template using index_sequence_for = make_index_sequence; template T exchange(T& obj, U&& new_value); // 20.2.7, in-place construction // C++17 struct in_place_t { explicit in_place_t() = default; }; inline constexpr in_place_t in_place{}; template struct in_place_type_t { explicit in_place_type_t() = default; }; template inline constexpr in_place_type_t in_place_type{}; template struct in_place_index_t { explicit in_place_index_t() = default; }; template inline constexpr in_place_index_t in_place_index{}; } // std */ #include <__config> #include <__tuple> #include #include #include #include #include #include #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD namespace rel_ops { template inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const _Tp& __x, const _Tp& __y) { return !(__x == __y); } template inline _LIBCPP_INLINE_VISIBILITY bool operator> (const _Tp& __x, const _Tp& __y) { return __y < __x; } template inline _LIBCPP_INLINE_VISIBILITY bool operator<=(const _Tp& __x, const _Tp& __y) { return !(__y < __x); } template inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const _Tp& __x, const _Tp& __y) { return !(__x < __y); } } // rel_ops // swap_ranges is defined in ` // swap is defined in // move_if_noexcept template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 #ifndef _LIBCPP_CXX03_LANG typename conditional < !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&& >::type #else // _LIBCPP_CXX03_LANG const _Tp& #endif move_if_noexcept(_Tp& __x) _NOEXCEPT { return _VSTD::move(__x); } #if _LIBCPP_STD_VER > 14 template constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; } template void as_const(const _Tp&&) = delete; #endif 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 /* _LIBCPP_INLINE_VAR */ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); #endif #if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) template 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 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 _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 using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type; struct _CheckArgs { template static constexpr bool __enable_explicit_default() { return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value && !__enable_implicit_default<>(); } template static constexpr bool __enable_implicit_default() { return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value; } template static constexpr bool __enable_explicit() { return is_constructible::value && is_constructible::value && (!is_convertible<_U1, first_type>::value || !is_convertible<_U2, second_type>::value); } template static constexpr bool __enable_implicit() { return is_constructible::value && is_constructible::value && is_convertible<_U1, first_type>::value && is_convertible<_U2, second_type>::value; } }; template using _CheckArgsDep _LIBCPP_NODEBUG_TYPE = typename conditional< _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type; struct _CheckTupleLikeConstructor { template static constexpr bool __enable_implicit() { return __tuple_convertible<_Tuple, pair>::value; } template static constexpr bool __enable_explicit() { return __tuple_constructible<_Tuple, pair>::value && !__tuple_convertible<_Tuple, pair>::value; } template static constexpr bool __enable_assign() { return __tuple_assignable<_Tuple, pair>::value; } }; template using _CheckTLC _LIBCPP_NODEBUG_TYPE = typename conditional< __tuple_like_with_size<_Tuple, 2>::value && !is_same::type, pair>::value, _CheckTupleLikeConstructor, __check_tuple_constructor_fail >::type; template::__enable_explicit_default() > = false> explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(is_nothrow_default_constructible::value && is_nothrow_default_constructible::value) : first(), second() {} template::__enable_implicit_default() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(is_nothrow_default_constructible::value && is_nothrow_default_constructible::value) : first(), second() {} template ::template __enable_explicit<_T1 const&, _T2 const&>() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit pair(_T1 const& __t1, _T2 const& __t2) _NOEXCEPT_(is_nothrow_copy_constructible::value && is_nothrow_copy_constructible::value) : first(__t1), second(__t2) {} template::template __enable_implicit<_T1 const&, _T2 const&>() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair(_T1 const& __t1, _T2 const& __t2) _NOEXCEPT_(is_nothrow_copy_constructible::value && is_nothrow_copy_constructible::value) : first(__t1), second(__t2) {} template() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit pair(_U1&& __u1, _U2&& __u2) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} template() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair(_U1&& __u1, _U2&& __u2) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} template() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit pair(pair<_U1, _U2> const& __p) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : first(__p.first), second(__p.second) {} template() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair(pair<_U1, _U2> const& __p) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : first(__p.first), second(__p.second) {} template() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit pair(pair<_U1, _U2>&&__p) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} template() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair(pair<_U1, _U2>&& __p) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} template::template __enable_explicit<_Tuple>() > = false> _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::template __enable_implicit<_Tuple>() > = false> _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 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) _NOEXCEPT_((is_nothrow_constructible::value && is_nothrow_constructible::value)) : pair(__pc, __first_args, __second_args, typename __make_tuple_indices::type(), typename __make_tuple_indices::type()) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair& operator=(typename conditional< is_copy_assignable::value && is_copy_assignable::value, pair, __nat>::type const& __p) _NOEXCEPT_(is_nothrow_copy_assignable::value && is_nothrow_copy_assignable::value) { first = __p.first; second = __p.second; return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 pair& operator=(typename conditional< is_move_assignable::value && is_move_assignable::value, pair, __nat>::type&& __p) _NOEXCEPT_(is_nothrow_move_assignable::value && is_nothrow_move_assignable::value) { first = _VSTD::forward(__p.first); second = _VSTD::forward(__p.second); return *this; } template ::template __enable_assign<_Tuple>() > = false> - _LIBCPP_INLINE_VISIBILITY + _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_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable::value && __is_nothrow_swappable::value) { using _VSTD::swap; swap(first, __p.first); swap(second, __p.second); } private: #ifndef _LIBCPP_CXX03_LANG template - _LIBCPP_INLINE_VISIBILITY - pair(piecewise_construct_t, - tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, - __tuple_indices<_I1...>, __tuple_indices<_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 }; #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES template pair(_T1, _T2) -> pair<_T1, _T2>; #endif // _LIBCPP_HAS_NO_DEDUCTION_GUIDES template 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; } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return !(__x == __y); } template 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 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return __y < __x; } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return !(__x < __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return !(__y < __x); } template -inline _LIBCPP_INLINE_VISIBILITY +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); } template struct __unwrap_reference { typedef _LIBCPP_NODEBUG_TYPE _Tp type; }; template struct __unwrap_reference > { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; }; #if _LIBCPP_STD_VER > 17 template struct unwrap_reference : __unwrap_reference<_Tp> { }; template struct unwrap_ref_decay : unwrap_reference::type> { }; #endif // > C++17 template struct __unwrap_ref_decay #if _LIBCPP_STD_VER > 17 : unwrap_ref_decay<_Tp> #else : __unwrap_reference::type> #endif { }; #ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair::type, typename __unwrap_ref_decay<_T2>::type> make_pair(_T1&& __t1, _T2&& __t2) { return pair::type, typename __unwrap_ref_decay<_T2>::type> (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); } #else // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY pair<_T1,_T2> make_pair(_T1 __x, _T2 __y) { return pair<_T1, _T2>(__x, __y); } #endif // _LIBCPP_CXX03_LANG template struct _LIBCPP_TEMPLATE_VIS tuple_size > : public integral_constant {}; template struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > { static_assert(_Ip < 2, "Index out of bounds in std::tuple_element>"); }; template struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > { typedef _LIBCPP_NODEBUG_TYPE _T1 type; }; template struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> > { typedef _LIBCPP_NODEBUG_TYPE _T2 type; }; template struct __get_pair; template <> struct __get_pair<0> { template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} template 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 static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);} template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward(__p.first);} #endif // _LIBCPP_CXX03_LANG }; template <> struct __get_pair<1> { template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} template 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 static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);} template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward(__p.second);} #endif // _LIBCPP_CXX03_LANG }; template 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 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 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 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 inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT { return __get_pair<0>::get(__p); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT { return __get_pair<0>::get(__p); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT { return __get_pair<0>::get(_VSTD::move(__p)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT { return __get_pair<0>::get(_VSTD::move(__p)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT { return __get_pair<1>::get(__p); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT { return __get_pair<1>::get(__p); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT { return __get_pair<1>::get(_VSTD::move(__p)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT { return __get_pair<1>::get(_VSTD::move(__p)); } #endif #if _LIBCPP_STD_VER > 11 template 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 using index_sequence = integer_sequence; #if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) template using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = __make_integer_seq; #else template using __make_integer_sequence_unchecked _LIBCPP_NODEBUG_TYPE = typename __detail::__make<_Np>::type::template __convert; template 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"); // Workaround GCC bug by preventing bad installations when 0 <= _Ep // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929 typedef _LIBCPP_NODEBUG_TYPE __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type; }; template using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = typename __make_integer_sequence_checked<_Tp, _Ep>::type; #endif template using make_integer_sequence = __make_integer_sequence<_Tp, _Np>; template using make_index_sequence = make_integer_sequence; template using index_sequence_for = make_index_sequence; #endif // _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11 template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _T1 exchange(_T1& __obj, _T2 && __new_value) { _T1 __old_value = _VSTD::move(__obj); __obj = _VSTD::forward<_T2>(__new_value); return __old_value; } #endif // _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 14 struct _LIBCPP_TYPE_VIS in_place_t { explicit in_place_t() = default; }; _LIBCPP_INLINE_VAR constexpr in_place_t in_place{}; template struct _LIBCPP_TEMPLATE_VIS in_place_type_t { explicit in_place_type_t() = default; }; template _LIBCPP_INLINE_VAR constexpr in_place_type_t<_Tp> in_place_type{}; template struct _LIBCPP_TYPE_VIS in_place_index_t { explicit in_place_index_t() = default; }; template _LIBCPP_INLINE_VAR constexpr in_place_index_t<_Idx> in_place_index{}; template struct __is_inplace_type_imp : false_type {}; template struct __is_inplace_type_imp> : true_type {}; template using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>; template struct __is_inplace_index_imp : false_type {}; template struct __is_inplace_index_imp> : true_type {}; template using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>; #endif // _LIBCPP_STD_VER > 14 template struct _LIBCPP_TEMPLATE_VIS unary_function { typedef _Arg argument_type; typedef _Result result_type; }; template inline _LIBCPP_INLINE_VISIBILITY _Size __loadword(const void* __p) { _Size __r; std::memcpy(&__r, __p, sizeof(__r)); return __r; } // We use murmur2 when size_t is 32 bits, and cityhash64 when size_t // is 64 bits. This is because cityhash64 uses 64bit x 64bit // multiplication, which can be very slow on 32-bit systems. template struct __murmur2_or_cityhash; template struct __murmur2_or_cityhash<_Size, 32> { inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK; }; // murmur2 template _Size __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) { const _Size __m = 0x5bd1e995; const _Size __r = 24; _Size __h = __len; const unsigned char* __data = static_cast(__key); for (; __len >= 4; __data += 4, __len -= 4) { _Size __k = __loadword<_Size>(__data); __k *= __m; __k ^= __k >> __r; __k *= __m; __h *= __m; __h ^= __k; } switch (__len) { case 3: __h ^= __data[2] << 16; _LIBCPP_FALLTHROUGH(); case 2: __h ^= __data[1] << 8; _LIBCPP_FALLTHROUGH(); case 1: __h ^= __data[0]; __h *= __m; } __h ^= __h >> 13; __h *= __m; __h ^= __h >> 15; return __h; } template struct __murmur2_or_cityhash<_Size, 64> { inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK; private: // Some primes between 2^63 and 2^64. static const _Size __k0 = 0xc3a5c85c97cb3127ULL; static const _Size __k1 = 0xb492b66fbe98f273ULL; static const _Size __k2 = 0x9ae16a3b2f90404fULL; static const _Size __k3 = 0xc949d7c7509e6557ULL; static _Size __rotate(_Size __val, int __shift) { return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift))); } static _Size __rotate_by_at_least_1(_Size __val, int __shift) { return (__val >> __shift) | (__val << (64 - __shift)); } static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); } static _Size __hash_len_16(_Size __u, _Size __v) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { const _Size __mul = 0x9ddfea08eb382d69ULL; _Size __a = (__u ^ __v) * __mul; __a ^= (__a >> 47); _Size __b = (__v ^ __a) * __mul; __b ^= (__b >> 47); __b *= __mul; return __b; } static _Size __hash_len_0_to_16(const char* __s, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { if (__len > 8) { const _Size __a = __loadword<_Size>(__s); const _Size __b = __loadword<_Size>(__s + __len - 8); return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b; } if (__len >= 4) { const uint32_t __a = __loadword(__s); const uint32_t __b = __loadword(__s + __len - 4); return __hash_len_16(__len + (__a << 3), __b); } if (__len > 0) { const unsigned char __a = __s[0]; const unsigned char __b = __s[__len >> 1]; const unsigned char __c = __s[__len - 1]; const uint32_t __y = static_cast(__a) + (static_cast(__b) << 8); const uint32_t __z = __len + (static_cast(__c) << 2); return __shift_mix(__y * __k2 ^ __z * __k3) * __k2; } return __k2; } static _Size __hash_len_17_to_32(const char *__s, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { const _Size __a = __loadword<_Size>(__s) * __k1; const _Size __b = __loadword<_Size>(__s + 8); const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2; const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0; return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d, __a + __rotate(__b ^ __k3, 20) - __c + __len); } // Return a 16-byte hash for 48 bytes. Quick and dirty. // Callers do best to use "random-looking" values for a and b. static pair<_Size, _Size> __weak_hash_len_32_with_seeds( _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { __a += __w; __b = __rotate(__b + __a + __z, 21); const _Size __c = __a; __a += __x; __a += __y; __b += __rotate(__a, 44); return pair<_Size, _Size>(__a + __z, __b + __c); } // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. static pair<_Size, _Size> __weak_hash_len_32_with_seeds( const char* __s, _Size __a, _Size __b) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s), __loadword<_Size>(__s + 8), __loadword<_Size>(__s + 16), __loadword<_Size>(__s + 24), __a, __b); } // Return an 8-byte hash for 33 to 64 bytes. static _Size __hash_len_33_to_64(const char *__s, size_t __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { _Size __z = __loadword<_Size>(__s + 24); _Size __a = __loadword<_Size>(__s) + (__len + __loadword<_Size>(__s + __len - 16)) * __k0; _Size __b = __rotate(__a + __z, 52); _Size __c = __rotate(__a, 37); __a += __loadword<_Size>(__s + 8); __c += __rotate(__a, 7); __a += __loadword<_Size>(__s + 16); _Size __vf = __a + __z; _Size __vs = __b + __rotate(__a, 31) + __c; __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32); __z += __loadword<_Size>(__s + __len - 8); __b = __rotate(__a + __z, 52); __c = __rotate(__a, 37); __a += __loadword<_Size>(__s + __len - 24); __c += __rotate(__a, 7); __a += __loadword<_Size>(__s + __len - 16); _Size __wf = __a + __z; _Size __ws = __b + __rotate(__a, 31) + __c; _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0); return __shift_mix(__r * __k0 + __vs) * __k2; } }; // cityhash64 template _Size __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) { const char* __s = static_cast(__key); if (__len <= 32) { if (__len <= 16) { return __hash_len_0_to_16(__s, __len); } else { return __hash_len_17_to_32(__s, __len); } } else if (__len <= 64) { return __hash_len_33_to_64(__s, __len); } // For strings over 64 bytes we hash the end first, and then as we // loop we keep 56 bytes of state: v, w, x, y, and z. _Size __x = __loadword<_Size>(__s + __len - 40); _Size __y = __loadword<_Size>(__s + __len - 16) + __loadword<_Size>(__s + __len - 56); _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len, __loadword<_Size>(__s + __len - 24)); pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); __x = __x * __k1 + __loadword<_Size>(__s); // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. __len = (__len - 1) & ~static_cast<_Size>(63); do { __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1; __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1; __x ^= __w.second; __y += __v.first + __loadword<_Size>(__s + 40); __z = __rotate(__z + __w.first, 33) * __k1; __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, __y + __loadword<_Size>(__s + 16)); std::swap(__z, __x); __s += 64; __len -= 64; } while (__len != 0); return __hash_len_16( __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, __hash_len_16(__v.second, __w.second) + __x); } template struct __scalar_hash; template struct __scalar_hash<_Tp, 0> : public unary_function<_Tp, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { union { _Tp __t; size_t __a; } __u; __u.__a = 0; __u.__t = __v; return __u.__a; } }; template struct __scalar_hash<_Tp, 1> : public unary_function<_Tp, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { union { _Tp __t; size_t __a; } __u; __u.__t = __v; return __u.__a; } }; template struct __scalar_hash<_Tp, 2> : public unary_function<_Tp, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { union { _Tp __t; struct { size_t __a; size_t __b; } __s; } __u; __u.__t = __v; return __murmur2_or_cityhash()(&__u, sizeof(__u)); } }; template struct __scalar_hash<_Tp, 3> : public unary_function<_Tp, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { union { _Tp __t; struct { size_t __a; size_t __b; size_t __c; } __s; } __u; __u.__t = __v; return __murmur2_or_cityhash()(&__u, sizeof(__u)); } }; template struct __scalar_hash<_Tp, 4> : public unary_function<_Tp, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { union { _Tp __t; struct { size_t __a; size_t __b; size_t __c; size_t __d; } __s; } __u; __u.__t = __v; return __murmur2_or_cityhash()(&__u, sizeof(__u)); } }; struct _PairT { size_t first; size_t second; }; _LIBCPP_INLINE_VISIBILITY inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT { typedef __scalar_hash<_PairT> _HashT; const _PairT __p = {__lhs, __rhs}; return _HashT()(__p); } template struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public unary_function<_Tp*, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp* __v) const _NOEXCEPT { union { _Tp* __t; size_t __a; } __u; __u.__t = __v; return __murmur2_or_cityhash()(&__u, sizeof(__u)); } }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(bool __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(char __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(signed char __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast(__v);} }; #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast(__v);} }; #endif // _LIBCPP_HAS_NO_UNICODE_CHARS template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(short __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(int __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(long __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast(__v);} }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public __scalar_hash { }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public __scalar_hash { }; #ifndef _LIBCPP_HAS_NO_INT128 template <> struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> { }; template <> struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t> : public __scalar_hash<__uint128_t> { }; #endif template <> struct _LIBCPP_TEMPLATE_VIS hash : public __scalar_hash { _LIBCPP_INLINE_VISIBILITY size_t operator()(float __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash if (__v == 0.0f) return 0; return __scalar_hash::operator()(__v); } }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public __scalar_hash { _LIBCPP_INLINE_VISIBILITY size_t operator()(double __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash if (__v == 0.0) return 0; return __scalar_hash::operator()(__v); } }; template <> struct _LIBCPP_TEMPLATE_VIS hash : public __scalar_hash { _LIBCPP_INLINE_VISIBILITY size_t operator()(long double __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash if (__v == 0.0L) return 0; #if defined(__i386__) // Zero out padding bits union { long double __t; struct { size_t __a; size_t __b; size_t __c; size_t __d; } __s; } __u; __u.__s.__a = 0; __u.__s.__b = 0; __u.__s.__c = 0; __u.__s.__d = 0; __u.__t = __v; return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d; #elif defined(__x86_64__) // Zero out padding bits union { long double __t; struct { size_t __a; size_t __b; } __s; } __u; __u.__s.__a = 0; __u.__s.__b = 0; __u.__t = __v; return __u.__s.__a ^ __u.__s.__b; #else return __scalar_hash::operator()(__v); #endif } }; #if _LIBCPP_STD_VER > 11 template ::value> struct _LIBCPP_TEMPLATE_VIS __enum_hash : public unary_function<_Tp, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp __v) const _NOEXCEPT { typedef typename underlying_type<_Tp>::type type; return hash{}(static_cast(__v)); } }; template struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> { __enum_hash() = delete; __enum_hash(__enum_hash const&) = delete; __enum_hash& operator=(__enum_hash const&) = delete; }; template struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> { }; #endif #if _LIBCPP_STD_VER > 14 template <> struct _LIBCPP_TEMPLATE_VIS hash : public unary_function { _LIBCPP_INLINE_VISIBILITY size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; } }; #endif #ifndef _LIBCPP_CXX03_LANG template using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant::value && is_move_constructible<_Hash>::value && __invokable_r::value >; template > using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant::value && is_default_constructible<_Hash>::value >; #if _LIBCPP_STD_VER > 14 template using __enable_hash_helper_imp _LIBCPP_NODEBUG_TYPE = _Type; template using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = __enable_hash_helper_imp<_Type, typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type >; #else template using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = _Type; #endif #endif // !_LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_UTILITY diff --git a/libcxx/include/version b/libcxx/include/version index acedd03073cc..dc53be3937c4 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -1,250 +1,252 @@ // -*- C++ -*- //===--------------------------- version ----------------------------------===// // // 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_VERSIONH #define _LIBCPP_VERSIONH /* version synopsis Macro name Value Headers __cpp_lib_addressof_constexpr 201603L __cpp_lib_allocator_traits_is_always_equal 201411L __cpp_lib_any 201606L __cpp_lib_apply 201603L __cpp_lib_array_constexpr 201811L 201603L // C++17 __cpp_lib_as_const 201510L __cpp_lib_atomic_is_always_lock_free 201603L __cpp_lib_atomic_ref 201806L __cpp_lib_bind_front 201811L __cpp_lib_bit_cast 201806L __cpp_lib_bool_constant 201505L __cpp_lib_boyer_moore_searcher 201603L __cpp_lib_byte 201603L __cpp_lib_char8_t 201811L __cpp_lib_chrono 201611L __cpp_lib_chrono_udls 201304L __cpp_lib_clamp 201603L __cpp_lib_complex_udls 201309L __cpp_lib_concepts 201806L __cpp_lib_constexpr_misc 201811L __cpp_lib_constexpr_swap_algorithms 201806L +__cpp_lib_constexpr_utility 201811L __cpp_lib_destroying_delete 201806L __cpp_lib_enable_shared_from_this 201603L __cpp_lib_endian 201907L __cpp_lib_erase_if 202002L __cpp_lib_exchange_function 201304L __cpp_lib_execution 201603L __cpp_lib_filesystem 201703L __cpp_lib_gcd_lcm 201606L __cpp_lib_generic_associative_lookup 201304L __cpp_lib_generic_unordered_lookup 201811L __cpp_lib_hardware_interference_size 201703L __cpp_lib_has_unique_object_representations 201606L __cpp_lib_hypot 201603L __cpp_lib_incomplete_container_elements 201505L __cpp_lib_integer_sequence 201304L __cpp_lib_integral_constant_callable 201304L __cpp_lib_interpolate 201902L __cpp_lib_invoke 201411L __cpp_lib_is_aggregate 201703L __cpp_lib_is_constant_evaluated 201811L __cpp_lib_is_final 201402L __cpp_lib_is_invocable 201703L __cpp_lib_is_null_pointer 201309L __cpp_lib_is_swappable 201603L __cpp_lib_launder 201606L __cpp_lib_list_remove_return_type 201806L __cpp_lib_logical_traits 201510L __cpp_lib_make_from_tuple 201606L __cpp_lib_make_reverse_iterator 201402L __cpp_lib_make_unique 201304L __cpp_lib_map_try_emplace 201411L __cpp_lib_math_constants 201907L __cpp_lib_math_special_functions 201603L __cpp_lib_memory_resource 201603L __cpp_lib_node_extract 201606L __cpp_lib_nonmember_container_access 201411L __cpp_lib_not_fn 201603L __cpp_lib_null_iterators 201304L __cpp_lib_optional 201606L __cpp_lib_parallel_algorithm 201603L __cpp_lib_quoted_string_io 201304L __cpp_lib_ranges 201811L __cpp_lib_raw_memory_algorithms 201606L __cpp_lib_result_of_sfinae 201210L __cpp_lib_robust_nonmodifying_seq_ops 201304L __cpp_lib_sample 201603L __cpp_lib_scoped_lock 201703L __cpp_lib_shared_mutex 201505L __cpp_lib_shared_ptr_arrays 201611L __cpp_lib_shared_ptr_weak_type 201606L __cpp_lib_shared_timed_mutex 201402L __cpp_lib_span 202002L __cpp_lib_string_udls 201304L __cpp_lib_string_view 201606L __cpp_lib_three_way_comparison 201711L __cpp_lib_to_array 201907L __cpp_lib_to_chars 201611L __cpp_lib_transformation_trait_aliases 201304L __cpp_lib_transparent_operators 201510L 201210L // C++14 __cpp_lib_tuple_element_t 201402L __cpp_lib_tuples_by_type 201304L __cpp_lib_type_trait_variable_templates 201510L __cpp_lib_uncaught_exceptions 201411L __cpp_lib_unordered_map_try_emplace 201411L __cpp_lib_variant 201606L __cpp_lib_void_t 201411L */ #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if _LIBCPP_STD_VER > 11 # define __cpp_lib_chrono_udls 201304L # define __cpp_lib_complex_udls 201309L # define __cpp_lib_exchange_function 201304L # define __cpp_lib_generic_associative_lookup 201304L # define __cpp_lib_integer_sequence 201304L # define __cpp_lib_integral_constant_callable 201304L # define __cpp_lib_is_final 201402L # define __cpp_lib_is_null_pointer 201309L # define __cpp_lib_make_reverse_iterator 201402L # define __cpp_lib_make_unique 201304L # define __cpp_lib_null_iterators 201304L # define __cpp_lib_quoted_string_io 201304L # define __cpp_lib_result_of_sfinae 201210L # define __cpp_lib_robust_nonmodifying_seq_ops 201304L # if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_shared_timed_mutex 201402L # endif # define __cpp_lib_string_udls 201304L # define __cpp_lib_transformation_trait_aliases 201304L # define __cpp_lib_transparent_operators 201210L # define __cpp_lib_tuple_element_t 201402L # define __cpp_lib_tuples_by_type 201304L #endif #if _LIBCPP_STD_VER > 14 # if !defined(_LIBCPP_HAS_NO_BUILTIN_ADDRESSOF) # define __cpp_lib_addressof_constexpr 201603L # endif # define __cpp_lib_allocator_traits_is_always_equal 201411L # define __cpp_lib_any 201606L # define __cpp_lib_apply 201603L # define __cpp_lib_array_constexpr 201603L # define __cpp_lib_as_const 201510L # if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_atomic_is_always_lock_free 201603L # endif # define __cpp_lib_bool_constant 201505L // # define __cpp_lib_boyer_moore_searcher 201603L # define __cpp_lib_byte 201603L # define __cpp_lib_chrono 201611L # define __cpp_lib_clamp 201603L # define __cpp_lib_enable_shared_from_this 201603L // # define __cpp_lib_execution 201603L # define __cpp_lib_filesystem 201703L # define __cpp_lib_gcd_lcm 201606L // # define __cpp_lib_hardware_interference_size 201703L # if defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS) # define __cpp_lib_has_unique_object_representations 201606L # endif # define __cpp_lib_hypot 201603L # define __cpp_lib_incomplete_container_elements 201505L # define __cpp_lib_invoke 201411L # if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) # define __cpp_lib_is_aggregate 201703L # endif # define __cpp_lib_is_invocable 201703L # define __cpp_lib_is_swappable 201603L # define __cpp_lib_launder 201606L # define __cpp_lib_logical_traits 201510L # define __cpp_lib_make_from_tuple 201606L # define __cpp_lib_map_try_emplace 201411L // # define __cpp_lib_math_special_functions 201603L // # define __cpp_lib_memory_resource 201603L # define __cpp_lib_node_extract 201606L # define __cpp_lib_nonmember_container_access 201411L # define __cpp_lib_not_fn 201603L # define __cpp_lib_optional 201606L // # define __cpp_lib_parallel_algorithm 201603L # define __cpp_lib_raw_memory_algorithms 201606L # define __cpp_lib_sample 201603L # define __cpp_lib_scoped_lock 201703L # if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_shared_mutex 201505L # endif // # define __cpp_lib_shared_ptr_arrays 201611L # define __cpp_lib_shared_ptr_weak_type 201606L # define __cpp_lib_string_view 201606L // # define __cpp_lib_to_chars 201611L # undef __cpp_lib_transparent_operators # define __cpp_lib_transparent_operators 201510L # define __cpp_lib_type_trait_variable_templates 201510L # define __cpp_lib_uncaught_exceptions 201411L # define __cpp_lib_unordered_map_try_emplace 201411L # define __cpp_lib_variant 201606L # define __cpp_lib_void_t 201411L #endif #if _LIBCPP_STD_VER > 17 # undef __cpp_lib_array_constexpr # define __cpp_lib_array_constexpr 201811L # if !defined(_LIBCPP_HAS_NO_THREADS) // # define __cpp_lib_atomic_ref 201806L # endif // # define __cpp_lib_bind_front 201811L // # define __cpp_lib_bit_cast 201806L # if !defined(_LIBCPP_NO_HAS_CHAR8_T) # define __cpp_lib_char8_t 201811L # endif // # define __cpp_lib_concepts 201806L // # define __cpp_lib_constexpr_misc 201811L // # define __cpp_lib_constexpr_swap_algorithms 201806L +# define __cpp_lib_constexpr_utility 201811L # if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L # define __cpp_lib_destroying_delete 201806L # endif # define __cpp_lib_endian 201907L # define __cpp_lib_erase_if 202002L // # define __cpp_lib_generic_unordered_lookup 201811L # define __cpp_lib_interpolate 201902L # if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) # define __cpp_lib_is_constant_evaluated 201811L # endif # define __cpp_lib_list_remove_return_type 201806L # if defined(__cpp_concepts) && __cpp_concepts >= 201811L # define __cpp_lib_math_constants 201907L # endif // # define __cpp_lib_ranges 201811L # define __cpp_lib_span 202002L // # define __cpp_lib_three_way_comparison 201711L # define __cpp_lib_to_array 201907L #endif #endif // _LIBCPP_VERSIONH diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp index 1fd38627a715..73762a4f12fa 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp @@ -1,194 +1,214 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // WARNING: This test was generated by generate_feature_test_macro_components.py // and should not be edited manually. // // Test the feature test macros defined by -/* Constant Value - __cpp_lib_as_const 201510L [C++17] - __cpp_lib_constexpr_misc 201811L [C++2a] - __cpp_lib_exchange_function 201304L [C++14] - __cpp_lib_integer_sequence 201304L [C++14] - __cpp_lib_to_chars 201611L [C++17] - __cpp_lib_tuples_by_type 201304L [C++14] +/* Constant Value + __cpp_lib_as_const 201510L [C++17] + __cpp_lib_constexpr_misc 201811L [C++2a] + __cpp_lib_constexpr_utility 201811L [C++2a] + __cpp_lib_exchange_function 201304L [C++14] + __cpp_lib_integer_sequence 201304L [C++14] + __cpp_lib_to_chars 201611L [C++17] + __cpp_lib_tuples_by_type 201304L [C++14] */ #include #include "test_macros.h" #if TEST_STD_VER < 14 # ifdef __cpp_lib_as_const # error "__cpp_lib_as_const should not be defined before c++17" # endif # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined before c++2a" # endif +# ifdef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should not be defined before c++2a" +# endif + # ifdef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should not be defined before c++14" # endif # ifdef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should not be defined before c++14" # endif # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined before c++17" # endif # ifdef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should not be defined before c++14" # endif #elif TEST_STD_VER == 14 # ifdef __cpp_lib_as_const # error "__cpp_lib_as_const should not be defined before c++17" # endif # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined before c++2a" # endif +# ifdef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should not be defined before c++2a" +# endif + # ifndef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should be defined in c++14" # endif # if __cpp_lib_exchange_function != 201304L # error "__cpp_lib_exchange_function should have the value 201304L in c++14" # endif # ifndef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should be defined in c++14" # endif # if __cpp_lib_integer_sequence != 201304L # error "__cpp_lib_integer_sequence should have the value 201304L in c++14" # endif # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined before c++17" # endif # ifndef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should be defined in c++14" # endif # if __cpp_lib_tuples_by_type != 201304L # error "__cpp_lib_tuples_by_type should have the value 201304L in c++14" # endif #elif TEST_STD_VER == 17 # ifndef __cpp_lib_as_const # error "__cpp_lib_as_const should be defined in c++17" # endif # if __cpp_lib_as_const != 201510L # error "__cpp_lib_as_const should have the value 201510L in c++17" # endif # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined before c++2a" # endif +# ifdef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should not be defined before c++2a" +# endif + # ifndef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should be defined in c++17" # endif # if __cpp_lib_exchange_function != 201304L # error "__cpp_lib_exchange_function should have the value 201304L in c++17" # endif # ifndef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should be defined in c++17" # endif # if __cpp_lib_integer_sequence != 201304L # error "__cpp_lib_integer_sequence should have the value 201304L in c++17" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_to_chars # error "__cpp_lib_to_chars should be defined in c++17" # endif # if __cpp_lib_to_chars != 201611L # error "__cpp_lib_to_chars should have the value 201611L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should be defined in c++17" # endif # if __cpp_lib_tuples_by_type != 201304L # error "__cpp_lib_tuples_by_type should have the value 201304L in c++17" # endif #elif TEST_STD_VER > 17 # ifndef __cpp_lib_as_const # error "__cpp_lib_as_const should be defined in c++2a" # endif # if __cpp_lib_as_const != 201510L # error "__cpp_lib_as_const should have the value 201510L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should be defined in c++2a" # endif # if __cpp_lib_constexpr_misc != 201811L # error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!" # endif # endif +# ifndef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should be defined in c++2a" +# endif +# if __cpp_lib_constexpr_utility != 201811L +# error "__cpp_lib_constexpr_utility should have the value 201811L in c++2a" +# endif + # ifndef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should be defined in c++2a" # endif # if __cpp_lib_exchange_function != 201304L # error "__cpp_lib_exchange_function should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should be defined in c++2a" # endif # if __cpp_lib_integer_sequence != 201304L # error "__cpp_lib_integer_sequence should have the value 201304L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_to_chars # error "__cpp_lib_to_chars should be defined in c++2a" # endif # if __cpp_lib_to_chars != 201611L # error "__cpp_lib_to_chars should have the value 201611L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should be defined in c++2a" # endif # if __cpp_lib_tuples_by_type != 201304L # error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a" # endif #endif // TEST_STD_VER > 17 int main(int, char**) { return 0; } diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp index 96a0fea6b918..5e485a2f585e 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp @@ -1,2290 +1,2310 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // WARNING: This test was generated by generate_feature_test_macro_components.py // and should not be edited manually. // // Test the feature test macros defined by /* Constant Value __cpp_lib_addressof_constexpr 201603L [C++17] __cpp_lib_allocator_traits_is_always_equal 201411L [C++17] __cpp_lib_any 201606L [C++17] __cpp_lib_apply 201603L [C++17] __cpp_lib_array_constexpr 201603L [C++17] 201811L [C++2a] __cpp_lib_as_const 201510L [C++17] __cpp_lib_atomic_is_always_lock_free 201603L [C++17] __cpp_lib_atomic_ref 201806L [C++2a] __cpp_lib_bind_front 201811L [C++2a] __cpp_lib_bit_cast 201806L [C++2a] __cpp_lib_bool_constant 201505L [C++17] __cpp_lib_boyer_moore_searcher 201603L [C++17] __cpp_lib_byte 201603L [C++17] __cpp_lib_char8_t 201811L [C++2a] __cpp_lib_chrono 201611L [C++17] __cpp_lib_chrono_udls 201304L [C++14] __cpp_lib_clamp 201603L [C++17] __cpp_lib_complex_udls 201309L [C++14] __cpp_lib_concepts 201806L [C++2a] __cpp_lib_constexpr_misc 201811L [C++2a] __cpp_lib_constexpr_swap_algorithms 201806L [C++2a] + __cpp_lib_constexpr_utility 201811L [C++2a] __cpp_lib_destroying_delete 201806L [C++2a] __cpp_lib_enable_shared_from_this 201603L [C++17] __cpp_lib_endian 201907L [C++2a] __cpp_lib_erase_if 202002L [C++2a] __cpp_lib_exchange_function 201304L [C++14] __cpp_lib_execution 201603L [C++17] __cpp_lib_filesystem 201703L [C++17] __cpp_lib_gcd_lcm 201606L [C++17] __cpp_lib_generic_associative_lookup 201304L [C++14] __cpp_lib_generic_unordered_lookup 201811L [C++2a] __cpp_lib_hardware_interference_size 201703L [C++17] __cpp_lib_has_unique_object_representations 201606L [C++17] __cpp_lib_hypot 201603L [C++17] __cpp_lib_incomplete_container_elements 201505L [C++17] __cpp_lib_integer_sequence 201304L [C++14] __cpp_lib_integral_constant_callable 201304L [C++14] __cpp_lib_interpolate 201902L [C++2a] __cpp_lib_invoke 201411L [C++17] __cpp_lib_is_aggregate 201703L [C++17] __cpp_lib_is_constant_evaluated 201811L [C++2a] __cpp_lib_is_final 201402L [C++14] __cpp_lib_is_invocable 201703L [C++17] __cpp_lib_is_null_pointer 201309L [C++14] __cpp_lib_is_swappable 201603L [C++17] __cpp_lib_launder 201606L [C++17] __cpp_lib_list_remove_return_type 201806L [C++2a] __cpp_lib_logical_traits 201510L [C++17] __cpp_lib_make_from_tuple 201606L [C++17] __cpp_lib_make_reverse_iterator 201402L [C++14] __cpp_lib_make_unique 201304L [C++14] __cpp_lib_map_try_emplace 201411L [C++17] __cpp_lib_math_constants 201907L [C++2a] __cpp_lib_math_special_functions 201603L [C++17] __cpp_lib_memory_resource 201603L [C++17] __cpp_lib_node_extract 201606L [C++17] __cpp_lib_nonmember_container_access 201411L [C++17] __cpp_lib_not_fn 201603L [C++17] __cpp_lib_null_iterators 201304L [C++14] __cpp_lib_optional 201606L [C++17] __cpp_lib_parallel_algorithm 201603L [C++17] __cpp_lib_quoted_string_io 201304L [C++14] __cpp_lib_ranges 201811L [C++2a] __cpp_lib_raw_memory_algorithms 201606L [C++17] __cpp_lib_result_of_sfinae 201210L [C++14] __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14] __cpp_lib_sample 201603L [C++17] __cpp_lib_scoped_lock 201703L [C++17] __cpp_lib_shared_mutex 201505L [C++17] __cpp_lib_shared_ptr_arrays 201611L [C++17] __cpp_lib_shared_ptr_weak_type 201606L [C++17] __cpp_lib_shared_timed_mutex 201402L [C++14] __cpp_lib_span 202002L [C++2a] __cpp_lib_string_udls 201304L [C++14] __cpp_lib_string_view 201606L [C++17] __cpp_lib_three_way_comparison 201711L [C++2a] __cpp_lib_to_array 201907L [C++2a] __cpp_lib_to_chars 201611L [C++17] __cpp_lib_transformation_trait_aliases 201304L [C++14] __cpp_lib_transparent_operators 201210L [C++14] 201510L [C++17] __cpp_lib_tuple_element_t 201402L [C++14] __cpp_lib_tuples_by_type 201304L [C++14] __cpp_lib_type_trait_variable_templates 201510L [C++17] __cpp_lib_uncaught_exceptions 201411L [C++17] __cpp_lib_unordered_map_try_emplace 201411L [C++17] __cpp_lib_variant 201606L [C++17] __cpp_lib_void_t 201411L [C++17] */ #include #include "test_macros.h" #if TEST_STD_VER < 14 # ifdef __cpp_lib_addressof_constexpr # error "__cpp_lib_addressof_constexpr should not be defined before c++17" # endif # ifdef __cpp_lib_allocator_traits_is_always_equal # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" # endif # ifdef __cpp_lib_any # error "__cpp_lib_any should not be defined before c++17" # endif # ifdef __cpp_lib_apply # error "__cpp_lib_apply should not be defined before c++17" # endif # ifdef __cpp_lib_array_constexpr # error "__cpp_lib_array_constexpr should not be defined before c++17" # endif # ifdef __cpp_lib_as_const # error "__cpp_lib_as_const should not be defined before c++17" # endif # ifdef __cpp_lib_atomic_is_always_lock_free # error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17" # endif # ifdef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should not be defined before c++2a" # endif # ifdef __cpp_lib_bind_front # error "__cpp_lib_bind_front should not be defined before c++2a" # endif # ifdef __cpp_lib_bit_cast # error "__cpp_lib_bit_cast should not be defined before c++2a" # endif # ifdef __cpp_lib_bool_constant # error "__cpp_lib_bool_constant should not be defined before c++17" # endif # ifdef __cpp_lib_boyer_moore_searcher # error "__cpp_lib_boyer_moore_searcher should not be defined before c++17" # endif # ifdef __cpp_lib_byte # error "__cpp_lib_byte should not be defined before c++17" # endif # ifdef __cpp_lib_char8_t # error "__cpp_lib_char8_t should not be defined before c++2a" # endif # ifdef __cpp_lib_chrono # error "__cpp_lib_chrono should not be defined before c++17" # endif # ifdef __cpp_lib_chrono_udls # error "__cpp_lib_chrono_udls should not be defined before c++14" # endif # ifdef __cpp_lib_clamp # error "__cpp_lib_clamp should not be defined before c++17" # endif # ifdef __cpp_lib_complex_udls # error "__cpp_lib_complex_udls should not be defined before c++14" # endif # ifdef __cpp_lib_concepts # error "__cpp_lib_concepts should not be defined before c++2a" # endif # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined before c++2a" # endif # ifdef __cpp_lib_constexpr_swap_algorithms # error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a" # endif +# ifdef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should not be defined before c++2a" +# endif + # ifdef __cpp_lib_destroying_delete # error "__cpp_lib_destroying_delete should not be defined before c++2a" # endif # ifdef __cpp_lib_enable_shared_from_this # error "__cpp_lib_enable_shared_from_this should not be defined before c++17" # endif # ifdef __cpp_lib_endian # error "__cpp_lib_endian should not be defined before c++2a" # endif # ifdef __cpp_lib_erase_if # error "__cpp_lib_erase_if should not be defined before c++2a" # endif # ifdef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should not be defined before c++14" # endif # ifdef __cpp_lib_execution # error "__cpp_lib_execution should not be defined before c++17" # endif # ifdef __cpp_lib_filesystem # error "__cpp_lib_filesystem should not be defined before c++17" # endif # ifdef __cpp_lib_gcd_lcm # error "__cpp_lib_gcd_lcm should not be defined before c++17" # endif # ifdef __cpp_lib_generic_associative_lookup # error "__cpp_lib_generic_associative_lookup should not be defined before c++14" # endif # ifdef __cpp_lib_generic_unordered_lookup # error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a" # endif # ifdef __cpp_lib_hardware_interference_size # error "__cpp_lib_hardware_interference_size should not be defined before c++17" # endif # ifdef __cpp_lib_has_unique_object_representations # error "__cpp_lib_has_unique_object_representations should not be defined before c++17" # endif # ifdef __cpp_lib_hypot # error "__cpp_lib_hypot should not be defined before c++17" # endif # ifdef __cpp_lib_incomplete_container_elements # error "__cpp_lib_incomplete_container_elements should not be defined before c++17" # endif # ifdef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should not be defined before c++14" # endif # ifdef __cpp_lib_integral_constant_callable # error "__cpp_lib_integral_constant_callable should not be defined before c++14" # endif # ifdef __cpp_lib_interpolate # error "__cpp_lib_interpolate should not be defined before c++2a" # endif # ifdef __cpp_lib_invoke # error "__cpp_lib_invoke should not be defined before c++17" # endif # ifdef __cpp_lib_is_aggregate # error "__cpp_lib_is_aggregate should not be defined before c++17" # endif # ifdef __cpp_lib_is_constant_evaluated # error "__cpp_lib_is_constant_evaluated should not be defined before c++2a" # endif # ifdef __cpp_lib_is_final # error "__cpp_lib_is_final should not be defined before c++14" # endif # ifdef __cpp_lib_is_invocable # error "__cpp_lib_is_invocable should not be defined before c++17" # endif # ifdef __cpp_lib_is_null_pointer # error "__cpp_lib_is_null_pointer should not be defined before c++14" # endif # ifdef __cpp_lib_is_swappable # error "__cpp_lib_is_swappable should not be defined before c++17" # endif # ifdef __cpp_lib_launder # error "__cpp_lib_launder should not be defined before c++17" # endif # ifdef __cpp_lib_list_remove_return_type # error "__cpp_lib_list_remove_return_type should not be defined before c++2a" # endif # ifdef __cpp_lib_logical_traits # error "__cpp_lib_logical_traits should not be defined before c++17" # endif # ifdef __cpp_lib_make_from_tuple # error "__cpp_lib_make_from_tuple should not be defined before c++17" # endif # ifdef __cpp_lib_make_reverse_iterator # error "__cpp_lib_make_reverse_iterator should not be defined before c++14" # endif # ifdef __cpp_lib_make_unique # error "__cpp_lib_make_unique should not be defined before c++14" # endif # ifdef __cpp_lib_map_try_emplace # error "__cpp_lib_map_try_emplace should not be defined before c++17" # endif # ifdef __cpp_lib_math_constants # error "__cpp_lib_math_constants should not be defined before c++2a" # endif # ifdef __cpp_lib_math_special_functions # error "__cpp_lib_math_special_functions should not be defined before c++17" # endif # ifdef __cpp_lib_memory_resource # error "__cpp_lib_memory_resource should not be defined before c++17" # endif # ifdef __cpp_lib_node_extract # error "__cpp_lib_node_extract should not be defined before c++17" # endif # ifdef __cpp_lib_nonmember_container_access # error "__cpp_lib_nonmember_container_access should not be defined before c++17" # endif # ifdef __cpp_lib_not_fn # error "__cpp_lib_not_fn should not be defined before c++17" # endif # ifdef __cpp_lib_null_iterators # error "__cpp_lib_null_iterators should not be defined before c++14" # endif # ifdef __cpp_lib_optional # error "__cpp_lib_optional should not be defined before c++17" # endif # ifdef __cpp_lib_parallel_algorithm # error "__cpp_lib_parallel_algorithm should not be defined before c++17" # endif # ifdef __cpp_lib_quoted_string_io # error "__cpp_lib_quoted_string_io should not be defined before c++14" # endif # ifdef __cpp_lib_ranges # error "__cpp_lib_ranges should not be defined before c++2a" # endif # ifdef __cpp_lib_raw_memory_algorithms # error "__cpp_lib_raw_memory_algorithms should not be defined before c++17" # endif # ifdef __cpp_lib_result_of_sfinae # error "__cpp_lib_result_of_sfinae should not be defined before c++14" # endif # ifdef __cpp_lib_robust_nonmodifying_seq_ops # error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14" # endif # ifdef __cpp_lib_sample # error "__cpp_lib_sample should not be defined before c++17" # endif # ifdef __cpp_lib_scoped_lock # error "__cpp_lib_scoped_lock should not be defined before c++17" # endif # ifdef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should not be defined before c++17" # endif # ifdef __cpp_lib_shared_ptr_arrays # error "__cpp_lib_shared_ptr_arrays should not be defined before c++17" # endif # ifdef __cpp_lib_shared_ptr_weak_type # error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17" # endif # ifdef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should not be defined before c++14" # endif # ifdef __cpp_lib_span # error "__cpp_lib_span should not be defined before c++2a" # endif # ifdef __cpp_lib_string_udls # error "__cpp_lib_string_udls should not be defined before c++14" # endif # ifdef __cpp_lib_string_view # error "__cpp_lib_string_view should not be defined before c++17" # endif # ifdef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should not be defined before c++2a" # endif # ifdef __cpp_lib_to_array # error "__cpp_lib_to_array should not be defined before c++2a" # endif # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined before c++17" # endif # ifdef __cpp_lib_transformation_trait_aliases # error "__cpp_lib_transformation_trait_aliases should not be defined before c++14" # endif # ifdef __cpp_lib_transparent_operators # error "__cpp_lib_transparent_operators should not be defined before c++14" # endif # ifdef __cpp_lib_tuple_element_t # error "__cpp_lib_tuple_element_t should not be defined before c++14" # endif # ifdef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should not be defined before c++14" # endif # ifdef __cpp_lib_type_trait_variable_templates # error "__cpp_lib_type_trait_variable_templates should not be defined before c++17" # endif # ifdef __cpp_lib_uncaught_exceptions # error "__cpp_lib_uncaught_exceptions should not be defined before c++17" # endif # ifdef __cpp_lib_unordered_map_try_emplace # error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17" # endif # ifdef __cpp_lib_variant # error "__cpp_lib_variant should not be defined before c++17" # endif # ifdef __cpp_lib_void_t # error "__cpp_lib_void_t should not be defined before c++17" # endif #elif TEST_STD_VER == 14 # ifdef __cpp_lib_addressof_constexpr # error "__cpp_lib_addressof_constexpr should not be defined before c++17" # endif # ifdef __cpp_lib_allocator_traits_is_always_equal # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" # endif # ifdef __cpp_lib_any # error "__cpp_lib_any should not be defined before c++17" # endif # ifdef __cpp_lib_apply # error "__cpp_lib_apply should not be defined before c++17" # endif # ifdef __cpp_lib_array_constexpr # error "__cpp_lib_array_constexpr should not be defined before c++17" # endif # ifdef __cpp_lib_as_const # error "__cpp_lib_as_const should not be defined before c++17" # endif # ifdef __cpp_lib_atomic_is_always_lock_free # error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17" # endif # ifdef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should not be defined before c++2a" # endif # ifdef __cpp_lib_bind_front # error "__cpp_lib_bind_front should not be defined before c++2a" # endif # ifdef __cpp_lib_bit_cast # error "__cpp_lib_bit_cast should not be defined before c++2a" # endif # ifdef __cpp_lib_bool_constant # error "__cpp_lib_bool_constant should not be defined before c++17" # endif # ifdef __cpp_lib_boyer_moore_searcher # error "__cpp_lib_boyer_moore_searcher should not be defined before c++17" # endif # ifdef __cpp_lib_byte # error "__cpp_lib_byte should not be defined before c++17" # endif # ifdef __cpp_lib_char8_t # error "__cpp_lib_char8_t should not be defined before c++2a" # endif # ifdef __cpp_lib_chrono # error "__cpp_lib_chrono should not be defined before c++17" # endif # ifndef __cpp_lib_chrono_udls # error "__cpp_lib_chrono_udls should be defined in c++14" # endif # if __cpp_lib_chrono_udls != 201304L # error "__cpp_lib_chrono_udls should have the value 201304L in c++14" # endif # ifdef __cpp_lib_clamp # error "__cpp_lib_clamp should not be defined before c++17" # endif # ifndef __cpp_lib_complex_udls # error "__cpp_lib_complex_udls should be defined in c++14" # endif # if __cpp_lib_complex_udls != 201309L # error "__cpp_lib_complex_udls should have the value 201309L in c++14" # endif # ifdef __cpp_lib_concepts # error "__cpp_lib_concepts should not be defined before c++2a" # endif # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined before c++2a" # endif # ifdef __cpp_lib_constexpr_swap_algorithms # error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a" # endif +# ifdef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should not be defined before c++2a" +# endif + # ifdef __cpp_lib_destroying_delete # error "__cpp_lib_destroying_delete should not be defined before c++2a" # endif # ifdef __cpp_lib_enable_shared_from_this # error "__cpp_lib_enable_shared_from_this should not be defined before c++17" # endif # ifdef __cpp_lib_endian # error "__cpp_lib_endian should not be defined before c++2a" # endif # ifdef __cpp_lib_erase_if # error "__cpp_lib_erase_if should not be defined before c++2a" # endif # ifndef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should be defined in c++14" # endif # if __cpp_lib_exchange_function != 201304L # error "__cpp_lib_exchange_function should have the value 201304L in c++14" # endif # ifdef __cpp_lib_execution # error "__cpp_lib_execution should not be defined before c++17" # endif # ifdef __cpp_lib_filesystem # error "__cpp_lib_filesystem should not be defined before c++17" # endif # ifdef __cpp_lib_gcd_lcm # error "__cpp_lib_gcd_lcm should not be defined before c++17" # endif # ifndef __cpp_lib_generic_associative_lookup # error "__cpp_lib_generic_associative_lookup should be defined in c++14" # endif # if __cpp_lib_generic_associative_lookup != 201304L # error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14" # endif # ifdef __cpp_lib_generic_unordered_lookup # error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a" # endif # ifdef __cpp_lib_hardware_interference_size # error "__cpp_lib_hardware_interference_size should not be defined before c++17" # endif # ifdef __cpp_lib_has_unique_object_representations # error "__cpp_lib_has_unique_object_representations should not be defined before c++17" # endif # ifdef __cpp_lib_hypot # error "__cpp_lib_hypot should not be defined before c++17" # endif # ifdef __cpp_lib_incomplete_container_elements # error "__cpp_lib_incomplete_container_elements should not be defined before c++17" # endif # ifndef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should be defined in c++14" # endif # if __cpp_lib_integer_sequence != 201304L # error "__cpp_lib_integer_sequence should have the value 201304L in c++14" # endif # ifndef __cpp_lib_integral_constant_callable # error "__cpp_lib_integral_constant_callable should be defined in c++14" # endif # if __cpp_lib_integral_constant_callable != 201304L # error "__cpp_lib_integral_constant_callable should have the value 201304L in c++14" # endif # ifdef __cpp_lib_interpolate # error "__cpp_lib_interpolate should not be defined before c++2a" # endif # ifdef __cpp_lib_invoke # error "__cpp_lib_invoke should not be defined before c++17" # endif # ifdef __cpp_lib_is_aggregate # error "__cpp_lib_is_aggregate should not be defined before c++17" # endif # ifdef __cpp_lib_is_constant_evaluated # error "__cpp_lib_is_constant_evaluated should not be defined before c++2a" # endif # ifndef __cpp_lib_is_final # error "__cpp_lib_is_final should be defined in c++14" # endif # if __cpp_lib_is_final != 201402L # error "__cpp_lib_is_final should have the value 201402L in c++14" # endif # ifdef __cpp_lib_is_invocable # error "__cpp_lib_is_invocable should not be defined before c++17" # endif # ifndef __cpp_lib_is_null_pointer # error "__cpp_lib_is_null_pointer should be defined in c++14" # endif # if __cpp_lib_is_null_pointer != 201309L # error "__cpp_lib_is_null_pointer should have the value 201309L in c++14" # endif # ifdef __cpp_lib_is_swappable # error "__cpp_lib_is_swappable should not be defined before c++17" # endif # ifdef __cpp_lib_launder # error "__cpp_lib_launder should not be defined before c++17" # endif # ifdef __cpp_lib_list_remove_return_type # error "__cpp_lib_list_remove_return_type should not be defined before c++2a" # endif # ifdef __cpp_lib_logical_traits # error "__cpp_lib_logical_traits should not be defined before c++17" # endif # ifdef __cpp_lib_make_from_tuple # error "__cpp_lib_make_from_tuple should not be defined before c++17" # endif # ifndef __cpp_lib_make_reverse_iterator # error "__cpp_lib_make_reverse_iterator should be defined in c++14" # endif # if __cpp_lib_make_reverse_iterator != 201402L # error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++14" # endif # ifndef __cpp_lib_make_unique # error "__cpp_lib_make_unique should be defined in c++14" # endif # if __cpp_lib_make_unique != 201304L # error "__cpp_lib_make_unique should have the value 201304L in c++14" # endif # ifdef __cpp_lib_map_try_emplace # error "__cpp_lib_map_try_emplace should not be defined before c++17" # endif # ifdef __cpp_lib_math_constants # error "__cpp_lib_math_constants should not be defined before c++2a" # endif # ifdef __cpp_lib_math_special_functions # error "__cpp_lib_math_special_functions should not be defined before c++17" # endif # ifdef __cpp_lib_memory_resource # error "__cpp_lib_memory_resource should not be defined before c++17" # endif # ifdef __cpp_lib_node_extract # error "__cpp_lib_node_extract should not be defined before c++17" # endif # ifdef __cpp_lib_nonmember_container_access # error "__cpp_lib_nonmember_container_access should not be defined before c++17" # endif # ifdef __cpp_lib_not_fn # error "__cpp_lib_not_fn should not be defined before c++17" # endif # ifndef __cpp_lib_null_iterators # error "__cpp_lib_null_iterators should be defined in c++14" # endif # if __cpp_lib_null_iterators != 201304L # error "__cpp_lib_null_iterators should have the value 201304L in c++14" # endif # ifdef __cpp_lib_optional # error "__cpp_lib_optional should not be defined before c++17" # endif # ifdef __cpp_lib_parallel_algorithm # error "__cpp_lib_parallel_algorithm should not be defined before c++17" # endif # ifndef __cpp_lib_quoted_string_io # error "__cpp_lib_quoted_string_io should be defined in c++14" # endif # if __cpp_lib_quoted_string_io != 201304L # error "__cpp_lib_quoted_string_io should have the value 201304L in c++14" # endif # ifdef __cpp_lib_ranges # error "__cpp_lib_ranges should not be defined before c++2a" # endif # ifdef __cpp_lib_raw_memory_algorithms # error "__cpp_lib_raw_memory_algorithms should not be defined before c++17" # endif # ifndef __cpp_lib_result_of_sfinae # error "__cpp_lib_result_of_sfinae should be defined in c++14" # endif # if __cpp_lib_result_of_sfinae != 201210L # error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14" # endif # ifndef __cpp_lib_robust_nonmodifying_seq_ops # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14" # endif # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14" # endif # ifdef __cpp_lib_sample # error "__cpp_lib_sample should not be defined before c++17" # endif # ifdef __cpp_lib_scoped_lock # error "__cpp_lib_scoped_lock should not be defined before c++17" # endif # ifdef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should not be defined before c++17" # endif # ifdef __cpp_lib_shared_ptr_arrays # error "__cpp_lib_shared_ptr_arrays should not be defined before c++17" # endif # ifdef __cpp_lib_shared_ptr_weak_type # error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++14" # endif # if __cpp_lib_shared_timed_mutex != 201402L # error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14" # endif # else # ifdef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # ifdef __cpp_lib_span # error "__cpp_lib_span should not be defined before c++2a" # endif # ifndef __cpp_lib_string_udls # error "__cpp_lib_string_udls should be defined in c++14" # endif # if __cpp_lib_string_udls != 201304L # error "__cpp_lib_string_udls should have the value 201304L in c++14" # endif # ifdef __cpp_lib_string_view # error "__cpp_lib_string_view should not be defined before c++17" # endif # ifdef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should not be defined before c++2a" # endif # ifdef __cpp_lib_to_array # error "__cpp_lib_to_array should not be defined before c++2a" # endif # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined before c++17" # endif # ifndef __cpp_lib_transformation_trait_aliases # error "__cpp_lib_transformation_trait_aliases should be defined in c++14" # endif # if __cpp_lib_transformation_trait_aliases != 201304L # error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++14" # endif # ifndef __cpp_lib_transparent_operators # error "__cpp_lib_transparent_operators should be defined in c++14" # endif # if __cpp_lib_transparent_operators != 201210L # error "__cpp_lib_transparent_operators should have the value 201210L in c++14" # endif # ifndef __cpp_lib_tuple_element_t # error "__cpp_lib_tuple_element_t should be defined in c++14" # endif # if __cpp_lib_tuple_element_t != 201402L # error "__cpp_lib_tuple_element_t should have the value 201402L in c++14" # endif # ifndef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should be defined in c++14" # endif # if __cpp_lib_tuples_by_type != 201304L # error "__cpp_lib_tuples_by_type should have the value 201304L in c++14" # endif # ifdef __cpp_lib_type_trait_variable_templates # error "__cpp_lib_type_trait_variable_templates should not be defined before c++17" # endif # ifdef __cpp_lib_uncaught_exceptions # error "__cpp_lib_uncaught_exceptions should not be defined before c++17" # endif # ifdef __cpp_lib_unordered_map_try_emplace # error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17" # endif # ifdef __cpp_lib_variant # error "__cpp_lib_variant should not be defined before c++17" # endif # ifdef __cpp_lib_void_t # error "__cpp_lib_void_t should not be defined before c++17" # endif #elif TEST_STD_VER == 17 # if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 # ifndef __cpp_lib_addressof_constexpr # error "__cpp_lib_addressof_constexpr should be defined in c++17" # endif # if __cpp_lib_addressof_constexpr != 201603L # error "__cpp_lib_addressof_constexpr should have the value 201603L in c++17" # endif # else # ifdef __cpp_lib_addressof_constexpr # error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!" # endif # endif # ifndef __cpp_lib_allocator_traits_is_always_equal # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17" # endif # if __cpp_lib_allocator_traits_is_always_equal != 201411L # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17" # endif # ifndef __cpp_lib_any # error "__cpp_lib_any should be defined in c++17" # endif # if __cpp_lib_any != 201606L # error "__cpp_lib_any should have the value 201606L in c++17" # endif # ifndef __cpp_lib_apply # error "__cpp_lib_apply should be defined in c++17" # endif # if __cpp_lib_apply != 201603L # error "__cpp_lib_apply should have the value 201603L in c++17" # endif # ifndef __cpp_lib_array_constexpr # error "__cpp_lib_array_constexpr should be defined in c++17" # endif # if __cpp_lib_array_constexpr != 201603L # error "__cpp_lib_array_constexpr should have the value 201603L in c++17" # endif # ifndef __cpp_lib_as_const # error "__cpp_lib_as_const should be defined in c++17" # endif # if __cpp_lib_as_const != 201510L # error "__cpp_lib_as_const should have the value 201510L in c++17" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_atomic_is_always_lock_free # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17" # endif # if __cpp_lib_atomic_is_always_lock_free != 201603L # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17" # endif # else # ifdef __cpp_lib_atomic_is_always_lock_free # error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # ifdef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should not be defined before c++2a" # endif # ifdef __cpp_lib_bind_front # error "__cpp_lib_bind_front should not be defined before c++2a" # endif # ifdef __cpp_lib_bit_cast # error "__cpp_lib_bit_cast should not be defined before c++2a" # endif # ifndef __cpp_lib_bool_constant # error "__cpp_lib_bool_constant should be defined in c++17" # endif # if __cpp_lib_bool_constant != 201505L # error "__cpp_lib_bool_constant should have the value 201505L in c++17" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_boyer_moore_searcher # error "__cpp_lib_boyer_moore_searcher should be defined in c++17" # endif # if __cpp_lib_boyer_moore_searcher != 201603L # error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_boyer_moore_searcher # error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_byte # error "__cpp_lib_byte should be defined in c++17" # endif # if __cpp_lib_byte != 201603L # error "__cpp_lib_byte should have the value 201603L in c++17" # endif # ifdef __cpp_lib_char8_t # error "__cpp_lib_char8_t should not be defined before c++2a" # endif # ifndef __cpp_lib_chrono # error "__cpp_lib_chrono should be defined in c++17" # endif # if __cpp_lib_chrono != 201611L # error "__cpp_lib_chrono should have the value 201611L in c++17" # endif # ifndef __cpp_lib_chrono_udls # error "__cpp_lib_chrono_udls should be defined in c++17" # endif # if __cpp_lib_chrono_udls != 201304L # error "__cpp_lib_chrono_udls should have the value 201304L in c++17" # endif # ifndef __cpp_lib_clamp # error "__cpp_lib_clamp should be defined in c++17" # endif # if __cpp_lib_clamp != 201603L # error "__cpp_lib_clamp should have the value 201603L in c++17" # endif # ifndef __cpp_lib_complex_udls # error "__cpp_lib_complex_udls should be defined in c++17" # endif # if __cpp_lib_complex_udls != 201309L # error "__cpp_lib_complex_udls should have the value 201309L in c++17" # endif # ifdef __cpp_lib_concepts # error "__cpp_lib_concepts should not be defined before c++2a" # endif # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined before c++2a" # endif # ifdef __cpp_lib_constexpr_swap_algorithms # error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a" # endif +# ifdef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should not be defined before c++2a" +# endif + # ifdef __cpp_lib_destroying_delete # error "__cpp_lib_destroying_delete should not be defined before c++2a" # endif # ifndef __cpp_lib_enable_shared_from_this # error "__cpp_lib_enable_shared_from_this should be defined in c++17" # endif # if __cpp_lib_enable_shared_from_this != 201603L # error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17" # endif # ifdef __cpp_lib_endian # error "__cpp_lib_endian should not be defined before c++2a" # endif # ifdef __cpp_lib_erase_if # error "__cpp_lib_erase_if should not be defined before c++2a" # endif # ifndef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should be defined in c++17" # endif # if __cpp_lib_exchange_function != 201304L # error "__cpp_lib_exchange_function should have the value 201304L in c++17" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_execution # error "__cpp_lib_execution should be defined in c++17" # endif # if __cpp_lib_execution != 201603L # error "__cpp_lib_execution should have the value 201603L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_execution # error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_filesystem # error "__cpp_lib_filesystem should be defined in c++17" # endif # if __cpp_lib_filesystem != 201703L # error "__cpp_lib_filesystem should have the value 201703L in c++17" # endif # ifndef __cpp_lib_gcd_lcm # error "__cpp_lib_gcd_lcm should be defined in c++17" # endif # if __cpp_lib_gcd_lcm != 201606L # error "__cpp_lib_gcd_lcm should have the value 201606L in c++17" # endif # ifndef __cpp_lib_generic_associative_lookup # error "__cpp_lib_generic_associative_lookup should be defined in c++17" # endif # if __cpp_lib_generic_associative_lookup != 201304L # error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17" # endif # ifdef __cpp_lib_generic_unordered_lookup # error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_hardware_interference_size # error "__cpp_lib_hardware_interference_size should be defined in c++17" # endif # if __cpp_lib_hardware_interference_size != 201703L # error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_hardware_interference_size # error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!" # endif # endif # if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 # ifndef __cpp_lib_has_unique_object_representations # error "__cpp_lib_has_unique_object_representations should be defined in c++17" # endif # if __cpp_lib_has_unique_object_representations != 201606L # error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++17" # endif # else # ifdef __cpp_lib_has_unique_object_representations # error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!" # endif # endif # ifndef __cpp_lib_hypot # error "__cpp_lib_hypot should be defined in c++17" # endif # if __cpp_lib_hypot != 201603L # error "__cpp_lib_hypot should have the value 201603L in c++17" # endif # ifndef __cpp_lib_incomplete_container_elements # error "__cpp_lib_incomplete_container_elements should be defined in c++17" # endif # if __cpp_lib_incomplete_container_elements != 201505L # error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17" # endif # ifndef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should be defined in c++17" # endif # if __cpp_lib_integer_sequence != 201304L # error "__cpp_lib_integer_sequence should have the value 201304L in c++17" # endif # ifndef __cpp_lib_integral_constant_callable # error "__cpp_lib_integral_constant_callable should be defined in c++17" # endif # if __cpp_lib_integral_constant_callable != 201304L # error "__cpp_lib_integral_constant_callable should have the value 201304L in c++17" # endif # ifdef __cpp_lib_interpolate # error "__cpp_lib_interpolate should not be defined before c++2a" # endif # ifndef __cpp_lib_invoke # error "__cpp_lib_invoke should be defined in c++17" # endif # if __cpp_lib_invoke != 201411L # error "__cpp_lib_invoke should have the value 201411L in c++17" # endif # if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 # ifndef __cpp_lib_is_aggregate # error "__cpp_lib_is_aggregate should be defined in c++17" # endif # if __cpp_lib_is_aggregate != 201703L # error "__cpp_lib_is_aggregate should have the value 201703L in c++17" # endif # else # ifdef __cpp_lib_is_aggregate # error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!" # endif # endif # ifdef __cpp_lib_is_constant_evaluated # error "__cpp_lib_is_constant_evaluated should not be defined before c++2a" # endif # ifndef __cpp_lib_is_final # error "__cpp_lib_is_final should be defined in c++17" # endif # if __cpp_lib_is_final != 201402L # error "__cpp_lib_is_final should have the value 201402L in c++17" # endif # ifndef __cpp_lib_is_invocable # error "__cpp_lib_is_invocable should be defined in c++17" # endif # if __cpp_lib_is_invocable != 201703L # error "__cpp_lib_is_invocable should have the value 201703L in c++17" # endif # ifndef __cpp_lib_is_null_pointer # error "__cpp_lib_is_null_pointer should be defined in c++17" # endif # if __cpp_lib_is_null_pointer != 201309L # error "__cpp_lib_is_null_pointer should have the value 201309L in c++17" # endif # ifndef __cpp_lib_is_swappable # error "__cpp_lib_is_swappable should be defined in c++17" # endif # if __cpp_lib_is_swappable != 201603L # error "__cpp_lib_is_swappable should have the value 201603L in c++17" # endif # ifndef __cpp_lib_launder # error "__cpp_lib_launder should be defined in c++17" # endif # if __cpp_lib_launder != 201606L # error "__cpp_lib_launder should have the value 201606L in c++17" # endif # ifdef __cpp_lib_list_remove_return_type # error "__cpp_lib_list_remove_return_type should not be defined before c++2a" # endif # ifndef __cpp_lib_logical_traits # error "__cpp_lib_logical_traits should be defined in c++17" # endif # if __cpp_lib_logical_traits != 201510L # error "__cpp_lib_logical_traits should have the value 201510L in c++17" # endif # ifndef __cpp_lib_make_from_tuple # error "__cpp_lib_make_from_tuple should be defined in c++17" # endif # if __cpp_lib_make_from_tuple != 201606L # error "__cpp_lib_make_from_tuple should have the value 201606L in c++17" # endif # ifndef __cpp_lib_make_reverse_iterator # error "__cpp_lib_make_reverse_iterator should be defined in c++17" # endif # if __cpp_lib_make_reverse_iterator != 201402L # error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++17" # endif # ifndef __cpp_lib_make_unique # error "__cpp_lib_make_unique should be defined in c++17" # endif # if __cpp_lib_make_unique != 201304L # error "__cpp_lib_make_unique should have the value 201304L in c++17" # endif # ifndef __cpp_lib_map_try_emplace # error "__cpp_lib_map_try_emplace should be defined in c++17" # endif # if __cpp_lib_map_try_emplace != 201411L # error "__cpp_lib_map_try_emplace should have the value 201411L in c++17" # endif # ifdef __cpp_lib_math_constants # error "__cpp_lib_math_constants should not be defined before c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_math_special_functions # error "__cpp_lib_math_special_functions should be defined in c++17" # endif # if __cpp_lib_math_special_functions != 201603L # error "__cpp_lib_math_special_functions should have the value 201603L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_math_special_functions # error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_memory_resource # error "__cpp_lib_memory_resource should be defined in c++17" # endif # if __cpp_lib_memory_resource != 201603L # error "__cpp_lib_memory_resource should have the value 201603L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_memory_resource # error "__cpp_lib_memory_resource should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_node_extract # error "__cpp_lib_node_extract should be defined in c++17" # endif # if __cpp_lib_node_extract != 201606L # error "__cpp_lib_node_extract should have the value 201606L in c++17" # endif # ifndef __cpp_lib_nonmember_container_access # error "__cpp_lib_nonmember_container_access should be defined in c++17" # endif # if __cpp_lib_nonmember_container_access != 201411L # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17" # endif # ifndef __cpp_lib_not_fn # error "__cpp_lib_not_fn should be defined in c++17" # endif # if __cpp_lib_not_fn != 201603L # error "__cpp_lib_not_fn should have the value 201603L in c++17" # endif # ifndef __cpp_lib_null_iterators # error "__cpp_lib_null_iterators should be defined in c++17" # endif # if __cpp_lib_null_iterators != 201304L # error "__cpp_lib_null_iterators should have the value 201304L in c++17" # endif # ifndef __cpp_lib_optional # error "__cpp_lib_optional should be defined in c++17" # endif # if __cpp_lib_optional != 201606L # error "__cpp_lib_optional should have the value 201606L in c++17" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_parallel_algorithm # error "__cpp_lib_parallel_algorithm should be defined in c++17" # endif # if __cpp_lib_parallel_algorithm != 201603L # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_parallel_algorithm # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_quoted_string_io # error "__cpp_lib_quoted_string_io should be defined in c++17" # endif # if __cpp_lib_quoted_string_io != 201304L # error "__cpp_lib_quoted_string_io should have the value 201304L in c++17" # endif # ifdef __cpp_lib_ranges # error "__cpp_lib_ranges should not be defined before c++2a" # endif # ifndef __cpp_lib_raw_memory_algorithms # error "__cpp_lib_raw_memory_algorithms should be defined in c++17" # endif # if __cpp_lib_raw_memory_algorithms != 201606L # error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++17" # endif # ifndef __cpp_lib_result_of_sfinae # error "__cpp_lib_result_of_sfinae should be defined in c++17" # endif # if __cpp_lib_result_of_sfinae != 201210L # error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17" # endif # ifndef __cpp_lib_robust_nonmodifying_seq_ops # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17" # endif # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17" # endif # ifndef __cpp_lib_sample # error "__cpp_lib_sample should be defined in c++17" # endif # if __cpp_lib_sample != 201603L # error "__cpp_lib_sample should have the value 201603L in c++17" # endif # ifndef __cpp_lib_scoped_lock # error "__cpp_lib_scoped_lock should be defined in c++17" # endif # if __cpp_lib_scoped_lock != 201703L # error "__cpp_lib_scoped_lock should have the value 201703L in c++17" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++17" # endif # if __cpp_lib_shared_mutex != 201505L # error "__cpp_lib_shared_mutex should have the value 201505L in c++17" # endif # else # ifdef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_shared_ptr_arrays # error "__cpp_lib_shared_ptr_arrays should be defined in c++17" # endif # if __cpp_lib_shared_ptr_arrays != 201611L # error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_shared_ptr_arrays # error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_shared_ptr_weak_type # error "__cpp_lib_shared_ptr_weak_type should be defined in c++17" # endif # if __cpp_lib_shared_ptr_weak_type != 201606L # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++17" # endif # if __cpp_lib_shared_timed_mutex != 201402L # error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17" # endif # else # ifdef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # ifdef __cpp_lib_span # error "__cpp_lib_span should not be defined before c++2a" # endif # ifndef __cpp_lib_string_udls # error "__cpp_lib_string_udls should be defined in c++17" # endif # if __cpp_lib_string_udls != 201304L # error "__cpp_lib_string_udls should have the value 201304L in c++17" # endif # ifndef __cpp_lib_string_view # error "__cpp_lib_string_view should be defined in c++17" # endif # if __cpp_lib_string_view != 201606L # error "__cpp_lib_string_view should have the value 201606L in c++17" # endif # ifdef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should not be defined before c++2a" # endif # ifdef __cpp_lib_to_array # error "__cpp_lib_to_array should not be defined before c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_to_chars # error "__cpp_lib_to_chars should be defined in c++17" # endif # if __cpp_lib_to_chars != 201611L # error "__cpp_lib_to_chars should have the value 201611L in c++17" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_transformation_trait_aliases # error "__cpp_lib_transformation_trait_aliases should be defined in c++17" # endif # if __cpp_lib_transformation_trait_aliases != 201304L # error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++17" # endif # ifndef __cpp_lib_transparent_operators # error "__cpp_lib_transparent_operators should be defined in c++17" # endif # if __cpp_lib_transparent_operators != 201510L # error "__cpp_lib_transparent_operators should have the value 201510L in c++17" # endif # ifndef __cpp_lib_tuple_element_t # error "__cpp_lib_tuple_element_t should be defined in c++17" # endif # if __cpp_lib_tuple_element_t != 201402L # error "__cpp_lib_tuple_element_t should have the value 201402L in c++17" # endif # ifndef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should be defined in c++17" # endif # if __cpp_lib_tuples_by_type != 201304L # error "__cpp_lib_tuples_by_type should have the value 201304L in c++17" # endif # ifndef __cpp_lib_type_trait_variable_templates # error "__cpp_lib_type_trait_variable_templates should be defined in c++17" # endif # if __cpp_lib_type_trait_variable_templates != 201510L # error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++17" # endif # ifndef __cpp_lib_uncaught_exceptions # error "__cpp_lib_uncaught_exceptions should be defined in c++17" # endif # if __cpp_lib_uncaught_exceptions != 201411L # error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++17" # endif # ifndef __cpp_lib_unordered_map_try_emplace # error "__cpp_lib_unordered_map_try_emplace should be defined in c++17" # endif # if __cpp_lib_unordered_map_try_emplace != 201411L # error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++17" # endif # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++17" # endif # if __cpp_lib_variant != 201606L # error "__cpp_lib_variant should have the value 201606L in c++17" # endif # ifndef __cpp_lib_void_t # error "__cpp_lib_void_t should be defined in c++17" # endif # if __cpp_lib_void_t != 201411L # error "__cpp_lib_void_t should have the value 201411L in c++17" # endif #elif TEST_STD_VER > 17 # if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 # ifndef __cpp_lib_addressof_constexpr # error "__cpp_lib_addressof_constexpr should be defined in c++2a" # endif # if __cpp_lib_addressof_constexpr != 201603L # error "__cpp_lib_addressof_constexpr should have the value 201603L in c++2a" # endif # else # ifdef __cpp_lib_addressof_constexpr # error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!" # endif # endif # ifndef __cpp_lib_allocator_traits_is_always_equal # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a" # endif # if __cpp_lib_allocator_traits_is_always_equal != 201411L # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a" # endif # ifndef __cpp_lib_any # error "__cpp_lib_any should be defined in c++2a" # endif # if __cpp_lib_any != 201606L # error "__cpp_lib_any should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_apply # error "__cpp_lib_apply should be defined in c++2a" # endif # if __cpp_lib_apply != 201603L # error "__cpp_lib_apply should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_array_constexpr # error "__cpp_lib_array_constexpr should be defined in c++2a" # endif # if __cpp_lib_array_constexpr != 201811L # error "__cpp_lib_array_constexpr should have the value 201811L in c++2a" # endif # ifndef __cpp_lib_as_const # error "__cpp_lib_as_const should be defined in c++2a" # endif # if __cpp_lib_as_const != 201510L # error "__cpp_lib_as_const should have the value 201510L in c++2a" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_atomic_is_always_lock_free # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a" # endif # if __cpp_lib_atomic_is_always_lock_free != 201603L # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a" # endif # else # ifdef __cpp_lib_atomic_is_always_lock_free # error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should be defined in c++2a" # endif # if __cpp_lib_atomic_ref != 201806L # error "__cpp_lib_atomic_ref should have the value 201806L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_bind_front # error "__cpp_lib_bind_front should be defined in c++2a" # endif # if __cpp_lib_bind_front != 201811L # error "__cpp_lib_bind_front should have the value 201811L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_bind_front # error "__cpp_lib_bind_front should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_bit_cast # error "__cpp_lib_bit_cast should be defined in c++2a" # endif # if __cpp_lib_bit_cast != 201806L # error "__cpp_lib_bit_cast should have the value 201806L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_bit_cast # error "__cpp_lib_bit_cast should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_bool_constant # error "__cpp_lib_bool_constant should be defined in c++2a" # endif # if __cpp_lib_bool_constant != 201505L # error "__cpp_lib_bool_constant should have the value 201505L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_boyer_moore_searcher # error "__cpp_lib_boyer_moore_searcher should be defined in c++2a" # endif # if __cpp_lib_boyer_moore_searcher != 201603L # error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_boyer_moore_searcher # error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_byte # error "__cpp_lib_byte should be defined in c++2a" # endif # if __cpp_lib_byte != 201603L # error "__cpp_lib_byte should have the value 201603L in c++2a" # endif # if defined(__cpp_char8_t) # ifndef __cpp_lib_char8_t # error "__cpp_lib_char8_t should be defined in c++2a" # endif # if __cpp_lib_char8_t != 201811L # error "__cpp_lib_char8_t should have the value 201811L in c++2a" # endif # else # ifdef __cpp_lib_char8_t # error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!" # endif # endif # ifndef __cpp_lib_chrono # error "__cpp_lib_chrono should be defined in c++2a" # endif # if __cpp_lib_chrono != 201611L # error "__cpp_lib_chrono should have the value 201611L in c++2a" # endif # ifndef __cpp_lib_chrono_udls # error "__cpp_lib_chrono_udls should be defined in c++2a" # endif # if __cpp_lib_chrono_udls != 201304L # error "__cpp_lib_chrono_udls should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_clamp # error "__cpp_lib_clamp should be defined in c++2a" # endif # if __cpp_lib_clamp != 201603L # error "__cpp_lib_clamp should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_complex_udls # error "__cpp_lib_complex_udls should be defined in c++2a" # endif # if __cpp_lib_complex_udls != 201309L # error "__cpp_lib_complex_udls should have the value 201309L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_concepts # error "__cpp_lib_concepts should be defined in c++2a" # endif # if __cpp_lib_concepts != 201806L # error "__cpp_lib_concepts should have the value 201806L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_concepts # error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should be defined in c++2a" # endif # if __cpp_lib_constexpr_misc != 201811L # error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_constexpr_misc # error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_constexpr_swap_algorithms # error "__cpp_lib_constexpr_swap_algorithms should be defined in c++2a" # endif # if __cpp_lib_constexpr_swap_algorithms != 201806L # error "__cpp_lib_constexpr_swap_algorithms should have the value 201806L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_constexpr_swap_algorithms # error "__cpp_lib_constexpr_swap_algorithms should not be defined because it is unimplemented in libc++!" # endif # endif +# ifndef __cpp_lib_constexpr_utility +# error "__cpp_lib_constexpr_utility should be defined in c++2a" +# endif +# if __cpp_lib_constexpr_utility != 201811L +# error "__cpp_lib_constexpr_utility should have the value 201811L in c++2a" +# endif + # if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L # ifndef __cpp_lib_destroying_delete # error "__cpp_lib_destroying_delete should be defined in c++2a" # endif # if __cpp_lib_destroying_delete != 201806L # error "__cpp_lib_destroying_delete should have the value 201806L in c++2a" # endif # else # ifdef __cpp_lib_destroying_delete # error "__cpp_lib_destroying_delete should not be defined when TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L is not defined!" # endif # endif # ifndef __cpp_lib_enable_shared_from_this # error "__cpp_lib_enable_shared_from_this should be defined in c++2a" # endif # if __cpp_lib_enable_shared_from_this != 201603L # error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_endian # error "__cpp_lib_endian should be defined in c++2a" # endif # if __cpp_lib_endian != 201907L # error "__cpp_lib_endian should have the value 201907L in c++2a" # endif # ifndef __cpp_lib_erase_if # error "__cpp_lib_erase_if should be defined in c++2a" # endif # if __cpp_lib_erase_if != 202002L # error "__cpp_lib_erase_if should have the value 202002L in c++2a" # endif # ifndef __cpp_lib_exchange_function # error "__cpp_lib_exchange_function should be defined in c++2a" # endif # if __cpp_lib_exchange_function != 201304L # error "__cpp_lib_exchange_function should have the value 201304L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_execution # error "__cpp_lib_execution should be defined in c++2a" # endif # if __cpp_lib_execution != 201603L # error "__cpp_lib_execution should have the value 201603L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_execution # error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_filesystem # error "__cpp_lib_filesystem should be defined in c++2a" # endif # if __cpp_lib_filesystem != 201703L # error "__cpp_lib_filesystem should have the value 201703L in c++2a" # endif # ifndef __cpp_lib_gcd_lcm # error "__cpp_lib_gcd_lcm should be defined in c++2a" # endif # if __cpp_lib_gcd_lcm != 201606L # error "__cpp_lib_gcd_lcm should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_generic_associative_lookup # error "__cpp_lib_generic_associative_lookup should be defined in c++2a" # endif # if __cpp_lib_generic_associative_lookup != 201304L # error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_generic_unordered_lookup # error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" # endif # if __cpp_lib_generic_unordered_lookup != 201811L # error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_generic_unordered_lookup # error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_hardware_interference_size # error "__cpp_lib_hardware_interference_size should be defined in c++2a" # endif # if __cpp_lib_hardware_interference_size != 201703L # error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_hardware_interference_size # error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!" # endif # endif # if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 # ifndef __cpp_lib_has_unique_object_representations # error "__cpp_lib_has_unique_object_representations should be defined in c++2a" # endif # if __cpp_lib_has_unique_object_representations != 201606L # error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++2a" # endif # else # ifdef __cpp_lib_has_unique_object_representations # error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!" # endif # endif # ifndef __cpp_lib_hypot # error "__cpp_lib_hypot should be defined in c++2a" # endif # if __cpp_lib_hypot != 201603L # error "__cpp_lib_hypot should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_incomplete_container_elements # error "__cpp_lib_incomplete_container_elements should be defined in c++2a" # endif # if __cpp_lib_incomplete_container_elements != 201505L # error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a" # endif # ifndef __cpp_lib_integer_sequence # error "__cpp_lib_integer_sequence should be defined in c++2a" # endif # if __cpp_lib_integer_sequence != 201304L # error "__cpp_lib_integer_sequence should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_integral_constant_callable # error "__cpp_lib_integral_constant_callable should be defined in c++2a" # endif # if __cpp_lib_integral_constant_callable != 201304L # error "__cpp_lib_integral_constant_callable should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_interpolate # error "__cpp_lib_interpolate should be defined in c++2a" # endif # if __cpp_lib_interpolate != 201902L # error "__cpp_lib_interpolate should have the value 201902L in c++2a" # endif # ifndef __cpp_lib_invoke # error "__cpp_lib_invoke should be defined in c++2a" # endif # if __cpp_lib_invoke != 201411L # error "__cpp_lib_invoke should have the value 201411L in c++2a" # endif # if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 # ifndef __cpp_lib_is_aggregate # error "__cpp_lib_is_aggregate should be defined in c++2a" # endif # if __cpp_lib_is_aggregate != 201703L # error "__cpp_lib_is_aggregate should have the value 201703L in c++2a" # endif # else # ifdef __cpp_lib_is_aggregate # error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!" # endif # endif # if TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900 # ifndef __cpp_lib_is_constant_evaluated # error "__cpp_lib_is_constant_evaluated should be defined in c++2a" # endif # if __cpp_lib_is_constant_evaluated != 201811L # error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2a" # endif # else # ifdef __cpp_lib_is_constant_evaluated # error "__cpp_lib_is_constant_evaluated should not be defined when TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900 is not defined!" # endif # endif # ifndef __cpp_lib_is_final # error "__cpp_lib_is_final should be defined in c++2a" # endif # if __cpp_lib_is_final != 201402L # error "__cpp_lib_is_final should have the value 201402L in c++2a" # endif # ifndef __cpp_lib_is_invocable # error "__cpp_lib_is_invocable should be defined in c++2a" # endif # if __cpp_lib_is_invocable != 201703L # error "__cpp_lib_is_invocable should have the value 201703L in c++2a" # endif # ifndef __cpp_lib_is_null_pointer # error "__cpp_lib_is_null_pointer should be defined in c++2a" # endif # if __cpp_lib_is_null_pointer != 201309L # error "__cpp_lib_is_null_pointer should have the value 201309L in c++2a" # endif # ifndef __cpp_lib_is_swappable # error "__cpp_lib_is_swappable should be defined in c++2a" # endif # if __cpp_lib_is_swappable != 201603L # error "__cpp_lib_is_swappable should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_launder # error "__cpp_lib_launder should be defined in c++2a" # endif # if __cpp_lib_launder != 201606L # error "__cpp_lib_launder should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_list_remove_return_type # error "__cpp_lib_list_remove_return_type should be defined in c++2a" # endif # if __cpp_lib_list_remove_return_type != 201806L # error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a" # endif # ifndef __cpp_lib_logical_traits # error "__cpp_lib_logical_traits should be defined in c++2a" # endif # if __cpp_lib_logical_traits != 201510L # error "__cpp_lib_logical_traits should have the value 201510L in c++2a" # endif # ifndef __cpp_lib_make_from_tuple # error "__cpp_lib_make_from_tuple should be defined in c++2a" # endif # if __cpp_lib_make_from_tuple != 201606L # error "__cpp_lib_make_from_tuple should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_make_reverse_iterator # error "__cpp_lib_make_reverse_iterator should be defined in c++2a" # endif # if __cpp_lib_make_reverse_iterator != 201402L # error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++2a" # endif # ifndef __cpp_lib_make_unique # error "__cpp_lib_make_unique should be defined in c++2a" # endif # if __cpp_lib_make_unique != 201304L # error "__cpp_lib_make_unique should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_map_try_emplace # error "__cpp_lib_map_try_emplace should be defined in c++2a" # endif # if __cpp_lib_map_try_emplace != 201411L # error "__cpp_lib_map_try_emplace should have the value 201411L in c++2a" # endif # if defined(__cpp_concepts) && __cpp_concepts >= 201811L # ifndef __cpp_lib_math_constants # error "__cpp_lib_math_constants should be defined in c++2a" # endif # if __cpp_lib_math_constants != 201907L # error "__cpp_lib_math_constants should have the value 201907L in c++2a" # endif # else # ifdef __cpp_lib_math_constants # error "__cpp_lib_math_constants should not be defined when defined(__cpp_concepts) && __cpp_concepts >= 201811L is not defined!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_math_special_functions # error "__cpp_lib_math_special_functions should be defined in c++2a" # endif # if __cpp_lib_math_special_functions != 201603L # error "__cpp_lib_math_special_functions should have the value 201603L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_math_special_functions # error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_memory_resource # error "__cpp_lib_memory_resource should be defined in c++2a" # endif # if __cpp_lib_memory_resource != 201603L # error "__cpp_lib_memory_resource should have the value 201603L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_memory_resource # error "__cpp_lib_memory_resource should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_node_extract # error "__cpp_lib_node_extract should be defined in c++2a" # endif # if __cpp_lib_node_extract != 201606L # error "__cpp_lib_node_extract should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_nonmember_container_access # error "__cpp_lib_nonmember_container_access should be defined in c++2a" # endif # if __cpp_lib_nonmember_container_access != 201411L # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a" # endif # ifndef __cpp_lib_not_fn # error "__cpp_lib_not_fn should be defined in c++2a" # endif # if __cpp_lib_not_fn != 201603L # error "__cpp_lib_not_fn should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_null_iterators # error "__cpp_lib_null_iterators should be defined in c++2a" # endif # if __cpp_lib_null_iterators != 201304L # error "__cpp_lib_null_iterators should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_optional # error "__cpp_lib_optional should be defined in c++2a" # endif # if __cpp_lib_optional != 201606L # error "__cpp_lib_optional should have the value 201606L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_parallel_algorithm # error "__cpp_lib_parallel_algorithm should be defined in c++2a" # endif # if __cpp_lib_parallel_algorithm != 201603L # error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_parallel_algorithm # error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_quoted_string_io # error "__cpp_lib_quoted_string_io should be defined in c++2a" # endif # if __cpp_lib_quoted_string_io != 201304L # error "__cpp_lib_quoted_string_io should have the value 201304L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++2a" # endif # if __cpp_lib_ranges != 201811L # error "__cpp_lib_ranges should have the value 201811L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_ranges # error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_raw_memory_algorithms # error "__cpp_lib_raw_memory_algorithms should be defined in c++2a" # endif # if __cpp_lib_raw_memory_algorithms != 201606L # error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_result_of_sfinae # error "__cpp_lib_result_of_sfinae should be defined in c++2a" # endif # if __cpp_lib_result_of_sfinae != 201210L # error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a" # endif # ifndef __cpp_lib_robust_nonmodifying_seq_ops # error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2a" # endif # if __cpp_lib_robust_nonmodifying_seq_ops != 201304L # error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_sample # error "__cpp_lib_sample should be defined in c++2a" # endif # if __cpp_lib_sample != 201603L # error "__cpp_lib_sample should have the value 201603L in c++2a" # endif # ifndef __cpp_lib_scoped_lock # error "__cpp_lib_scoped_lock should be defined in c++2a" # endif # if __cpp_lib_scoped_lock != 201703L # error "__cpp_lib_scoped_lock should have the value 201703L in c++2a" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++2a" # endif # if __cpp_lib_shared_mutex != 201505L # error "__cpp_lib_shared_mutex should have the value 201505L in c++2a" # endif # else # ifdef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_shared_ptr_arrays # error "__cpp_lib_shared_ptr_arrays should be defined in c++2a" # endif # if __cpp_lib_shared_ptr_arrays != 201611L # error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_shared_ptr_arrays # error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_shared_ptr_weak_type # error "__cpp_lib_shared_ptr_weak_type should be defined in c++2a" # endif # if __cpp_lib_shared_ptr_weak_type != 201606L # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2a" # endif # if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++2a" # endif # if __cpp_lib_shared_timed_mutex != 201402L # error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2a" # endif # else # ifdef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif # ifndef __cpp_lib_span # error "__cpp_lib_span should be defined in c++2a" # endif # if __cpp_lib_span != 202002L # error "__cpp_lib_span should have the value 202002L in c++2a" # endif # ifndef __cpp_lib_string_udls # error "__cpp_lib_string_udls should be defined in c++2a" # endif # if __cpp_lib_string_udls != 201304L # error "__cpp_lib_string_udls should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_string_view # error "__cpp_lib_string_view should be defined in c++2a" # endif # if __cpp_lib_string_view != 201606L # error "__cpp_lib_string_view should have the value 201606L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++2a" # endif # if __cpp_lib_three_way_comparison != 201711L # error "__cpp_lib_three_way_comparison should have the value 201711L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_to_array # error "__cpp_lib_to_array should be defined in c++2a" # endif # if __cpp_lib_to_array != 201907L # error "__cpp_lib_to_array should have the value 201907L in c++2a" # endif # if !defined(_LIBCPP_VERSION) # ifndef __cpp_lib_to_chars # error "__cpp_lib_to_chars should be defined in c++2a" # endif # if __cpp_lib_to_chars != 201611L # error "__cpp_lib_to_chars should have the value 201611L in c++2a" # endif # else // _LIBCPP_VERSION # ifdef __cpp_lib_to_chars # error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!" # endif # endif # ifndef __cpp_lib_transformation_trait_aliases # error "__cpp_lib_transformation_trait_aliases should be defined in c++2a" # endif # if __cpp_lib_transformation_trait_aliases != 201304L # error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_transparent_operators # error "__cpp_lib_transparent_operators should be defined in c++2a" # endif # if __cpp_lib_transparent_operators != 201510L # error "__cpp_lib_transparent_operators should have the value 201510L in c++2a" # endif # ifndef __cpp_lib_tuple_element_t # error "__cpp_lib_tuple_element_t should be defined in c++2a" # endif # if __cpp_lib_tuple_element_t != 201402L # error "__cpp_lib_tuple_element_t should have the value 201402L in c++2a" # endif # ifndef __cpp_lib_tuples_by_type # error "__cpp_lib_tuples_by_type should be defined in c++2a" # endif # if __cpp_lib_tuples_by_type != 201304L # error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a" # endif # ifndef __cpp_lib_type_trait_variable_templates # error "__cpp_lib_type_trait_variable_templates should be defined in c++2a" # endif # if __cpp_lib_type_trait_variable_templates != 201510L # error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++2a" # endif # ifndef __cpp_lib_uncaught_exceptions # error "__cpp_lib_uncaught_exceptions should be defined in c++2a" # endif # if __cpp_lib_uncaught_exceptions != 201411L # error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++2a" # endif # ifndef __cpp_lib_unordered_map_try_emplace # error "__cpp_lib_unordered_map_try_emplace should be defined in c++2a" # endif # if __cpp_lib_unordered_map_try_emplace != 201411L # error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++2a" # endif # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++2a" # endif # if __cpp_lib_variant != 201606L # error "__cpp_lib_variant should have the value 201606L in c++2a" # endif # ifndef __cpp_lib_void_t # error "__cpp_lib_void_t should be defined in c++2a" # endif # if __cpp_lib_void_t != 201411L # error "__cpp_lib_void_t should have the value 201411L in c++2a" # endif #endif // TEST_STD_VER > 17 int main(int, char**) { return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp index 078d424a1ba3..becf36e66cf3 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp @@ -1,53 +1,71 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // template struct pair // template pair& operator=(const pair& p); #include #include #include "test_macros.h" #if TEST_STD_VER >= 11 #include "archetypes.h" #endif -int main(int, char**) -{ - { - typedef std::pair P1; - typedef std::pair P2; - P1 p1(3, static_cast(4)); - P2 p2; - p2 = p1; - assert(p2.first == 3); - assert(p2.second == 4); - } -#if TEST_STD_VER >= 11 - { - using C = TestTypes::TestType; - using P = std::pair; - using T = std::pair; - const T t(42, -42); - P p(101, 101); - C::reset_constructors(); - p = t; - assert(C::constructed == 0); - assert(C::assigned == 1); - assert(C::copy_assigned == 1); - assert(C::move_assigned == 0); - assert(p.first == 42); - assert(p.second.value == -42); - } +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P1; + typedef std::pair P2; + P1 p1(3, static_cast(4)); + P2 p2; + p2 = p1; + assert(p2.first == 3); + assert(p2.second == 4); + } +#if TEST_STD_VER >= 20 + { + using C = ConstexprTestTypes::TestType; + using P = std::pair; + using T = std::pair; + const T t(42, -42); + P p(101, 101); + p = t; + assert(p.first == 42); + assert(p.second.value == -42); + } +#elif TEST_STD_VER >= 11 + { + using C = TestTypes::TestType; + using P = std::pair; + using T = std::pair; + const T t(42, -42); + P p(101, 101); + C::reset_constructors(); + p = t; + assert(C::constructed == 0); + assert(C::assigned == 1); + assert(C::copy_assigned == 1); + assert(C::move_assigned == 0); + assert(p.first == 42); + assert(p.second.value == -42); + } +#endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); #endif return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp index 303aedf50969..94e30aec3332 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp @@ -1,104 +1,100 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 // // template struct pair // pair& operator=(pair const& p); #include #include #include #include "test_macros.h" - - -struct NonAssignable { - NonAssignable& operator=(NonAssignable const&) = delete; - NonAssignable& operator=(NonAssignable&&) = delete; -}; -struct CopyAssignable { - CopyAssignable() = default; - CopyAssignable(CopyAssignable const&) = default; - CopyAssignable& operator=(CopyAssignable const&) = default; - CopyAssignable& operator=(CopyAssignable&&) = delete; -}; -struct MoveAssignable { - MoveAssignable() = default; - MoveAssignable& operator=(MoveAssignable const&) = delete; - MoveAssignable& operator=(MoveAssignable&&) = default; -}; +#include "archetypes.h" struct CountAssign { - static int copied; - static int moved; - static void reset() { copied = moved = 0; } - CountAssign() = default; - CountAssign& operator=(CountAssign const&) { ++copied; return *this; } - CountAssign& operator=(CountAssign&&) { ++moved; return *this; } + int copied = 0; + int moved = 0; + TEST_CONSTEXPR_CXX20 CountAssign() = default; + TEST_CONSTEXPR_CXX20 CountAssign& operator=(CountAssign const&) { + ++copied; + return *this; + } + TEST_CONSTEXPR_CXX20 CountAssign& operator=(CountAssign&&) { + ++moved; + return *this; + } }; -int CountAssign::copied = 0; -int CountAssign::moved = 0; struct Incomplete; extern Incomplete inc_obj; -int main(int, char**) -{ - { - typedef std::pair P; - const P p1(CopyAssignable(), short{4}); - P p2; - p2 = p1; - assert(p2.second == 4); - } - { - using P = std::pair; - int x = 42; - int y = 101; - int x2 = -1; - int y2 = 300; - P p1(x, std::move(y)); - P p2(x2, std::move(y2)); - p1 = p2; - assert(p1.first == x2); - assert(p1.second == y2); - } - { - using P = std::pair; - static_assert(!std::is_copy_assignable

::value, ""); - } - { - CountAssign::reset(); - using P = std::pair; - static_assert(std::is_copy_assignable

::value, ""); - P p; - P p2; - p = p2; - assert(CountAssign::copied == 1); - assert(CountAssign::moved == 0); - } - { - using P = std::pair; - static_assert(!std::is_copy_assignable

::value, ""); - } - { - using P = std::pair; - static_assert(!std::is_copy_assignable

::value, ""); - P p(42, inc_obj); - assert(&p.second == &inc_obj); - } +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P; + const P p1(ConstexprTestTypes::CopyOnly(), short{4}); + P p2; + p2 = p1; + assert(p2.second == 4); + } + { + using P = std::pair; + int x = 42; + int y = 101; + int x2 = -1; + int y2 = 300; + P p1(x, std::move(y)); + P p2(x2, std::move(y2)); + p1 = p2; + assert(p1.first == x2); + assert(p1.second == y2); + } + { + using P = std::pair; + static_assert(!std::is_copy_assignable

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_assignable

::value, ""); + P p; + P p2; + p = p2; + assert(p.first.copied == 1); + assert(p.first.moved == 0); + assert(p2.first.copied == 0); + assert(p2.first.moved == 0); + } + { + using P = std::pair; + static_assert(!std::is_copy_assignable

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_copy_assignable

::value, ""); + P p(42, inc_obj); + assert(&p.second == &inc_obj); + } + + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif - return 0; + return 0; } struct Incomplete {}; Incomplete inc_obj; diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp index 811e89015b48..cc4e4f5c1108 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp @@ -1,99 +1,96 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 // // template struct pair // pair& operator=(pair&& p); #include #include #include #include "test_macros.h" - - -struct NonAssignable { - NonAssignable& operator=(NonAssignable const&) = delete; - NonAssignable& operator=(NonAssignable&&) = delete; -}; -struct CopyAssignable { - CopyAssignable() = default; - CopyAssignable& operator=(CopyAssignable const&) = default; - CopyAssignable& operator=(CopyAssignable&&) = delete; -}; -struct MoveAssignable { - MoveAssignable() = default; - MoveAssignable& operator=(MoveAssignable const&) = delete; - MoveAssignable& operator=(MoveAssignable&&) = default; -}; +#include "archetypes.h" struct CountAssign { - static int copied; - static int moved; - static void reset() { copied = moved = 0; } - CountAssign() = default; - CountAssign& operator=(CountAssign const&) { ++copied; return *this; } - CountAssign& operator=(CountAssign&&) { ++moved; return *this; } + int copied = 0; + int moved = 0; + TEST_CONSTEXPR_CXX20 CountAssign() = default; + TEST_CONSTEXPR_CXX20 CountAssign& operator=(CountAssign const&) { + ++copied; + return *this; + } + TEST_CONSTEXPR_CXX20 CountAssign& operator=(CountAssign&&) { + ++moved; + return *this; + } }; -int CountAssign::copied = 0; -int CountAssign::moved = 0; -int main(int, char**) -{ - { - typedef std::pair, int> P; - P p1(std::unique_ptr(new int(3)), 4); - P p2; - p2 = std::move(p1); - assert(*p2.first == 3); - assert(p2.second == 4); - } - { - using P = std::pair; - int x = 42; - int y = 101; - int x2 = -1; - int y2 = 300; - P p1(x, std::move(y)); - P p2(x2, std::move(y2)); - p1 = std::move(p2); - assert(p1.first == x2); - assert(p1.second == y2); - } - { - using P = std::pair; - static_assert(!std::is_move_assignable

::value, ""); - } - { - // The move decays to the copy constructor - CountAssign::reset(); - using P = std::pair; - static_assert(std::is_move_assignable

::value, ""); - P p; - P p2; - p = std::move(p2); - assert(CountAssign::moved == 0); - assert(CountAssign::copied == 1); - } - { - CountAssign::reset(); - using P = std::pair; - static_assert(std::is_move_assignable

::value, ""); - P p; - P p2; - p = std::move(p2); - assert(CountAssign::moved == 1); - assert(CountAssign::copied == 0); - } +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P; + P p1(3, 4); + P p2; + p2 = std::move(p1); + assert(p2.first.value == 3); + assert(p2.second == 4); + } + { + using P = std::pair; + int x = 42; + int y = 101; + int x2 = -1; + int y2 = 300; + P p1(x, std::move(y)); + P p2(x2, std::move(y2)); + p1 = std::move(p2); + assert(p1.first == x2); + assert(p1.second == y2); + } + { + using P = std::pair; + static_assert(!std::is_move_assignable

::value, ""); + } + { + // The move decays to the copy constructor + using P = std::pair; + static_assert(std::is_move_assignable

::value, ""); + P p; + P p2; + p = std::move(p2); + assert(p.first.moved == 0); + assert(p.first.copied == 1); + assert(p2.first.moved == 0); + assert(p2.first.copied == 0); + } + { + using P = std::pair; + static_assert(std::is_move_assignable

::value, ""); + P p; + P p2; + p = std::move(p2); + assert(p.first.moved == 1); + assert(p.first.copied == 0); + assert(p2.first.moved == 0); + assert(p2.first.copied == 0); + } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp index ed56480b2f77..7267f7a2ef8b 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp @@ -1,62 +1,74 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 // // template struct pair // template pair& operator=(pair&& p); #include #include #include -#include #include "test_macros.h" +#include "archetypes.h" -struct Base -{ - virtual ~Base() {} +struct Derived : ConstexprTestTypes::MoveOnly { + Derived() = default; + TEST_CONSTEXPR_CXX20 Derived(ConstexprTestTypes::MoveOnly&&){}; }; - -struct Derived - : public Base -{ +struct CountAssign { + int copied = 0; + int moved = 0; + TEST_CONSTEXPR_CXX20 CountAssign() = default; + TEST_CONSTEXPR_CXX20 CountAssign(const int){}; + TEST_CONSTEXPR_CXX20 CountAssign& operator=(CountAssign const&) { + ++copied; + return *this; + } + TEST_CONSTEXPR_CXX20 CountAssign& operator=(CountAssign&&) { + ++moved; + return *this; + } }; -int main(int, char**) -{ - { - typedef std::pair, short> P1; - typedef std::pair, long> P2; - P1 p1(std::unique_ptr(), static_cast(4)); - P2 p2; - p2 = std::move(p1); - assert(p2.first == nullptr); - assert(p2.second == 4); - } - { - using C = TestTypes::TestType; - using P = std::pair; - using T = std::pair; - T t(42, -42); - P p(101, 101); - C::reset_constructors(); - p = std::move(t); - assert(C::constructed == 0); - assert(C::assigned == 1); - assert(C::copy_assigned == 0); - assert(C::move_assigned == 1); - assert(p.first == 42); - assert(p.second.value == -42); - } +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P1; + typedef std::pair P2; + P1 p1(Derived(), static_cast(4)); + P2 p2; + p2 = std::move(p1); + assert(p2.second == 4); + } + { + using P = std::pair; + using T = std::pair; + T t(42, -42); + P p(101, 101); + p = std::move(t); + assert(p.first == 42); + assert(p.second.moved == 1); + assert(p.second.copied == 0); + assert(t.second.moved == 0); + assert(t.second.copied == 0); + } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp index 358689ed0b97..42ddb4e6058b 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp @@ -1,184 +1,201 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 // // template struct pair // template EXPLICIT constexpr pair(const pair& p); #include #include #include "archetypes.h" #include "test_convertible.h" #include "test_macros.h" using namespace ImplicitTypes; // Get implicitly archetypes -template -void test_pair_const() -{ - using P1 = std::pair; - using P2 = std::pair; - using UP1 = std::pair const&; - using UP2 = std::pair const&; - static_assert(std::is_constructible::value == CanCopy, ""); - static_assert(test_convertible() == CanConvert, ""); - static_assert(std::is_constructible::value == CanCopy, ""); - static_assert(test_convertible() == CanConvert, ""); +template +TEST_CONSTEXPR_CXX20 void test_pair_const() { + using P1 = std::pair; + using P2 = std::pair; + using UP1 = std::pair const&; + using UP2 = std::pair const&; + static_assert(std::is_constructible::value == CanCopy, ""); + static_assert(test_convertible() == CanConvert, ""); + static_assert(std::is_constructible::value == CanCopy, ""); + static_assert(test_convertible() == CanConvert, ""); } template struct DPair : public std::pair { using Base = std::pair; using Base::Base; }; struct ExplicitT { constexpr explicit ExplicitT(int x) : value(x) {} constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {} int value; }; struct ImplicitT { constexpr ImplicitT(int x) : value(x) {} constexpr ImplicitT(ImplicitT const& o) : value(o.value) {} int value; }; -int main(int, char**) -{ - { - typedef std::pair P1; - typedef std::pair P2; - const P1 p1(3, 4); - const P2 p2 = p1; - assert(p2.first == 3); - assert(p2.second == 4); - } - { - // We allow derived types to use this constructor - using P1 = DPair; - using P2 = std::pair; - P1 p1(42, 101); - P2 p2(p1); - assert(p2.first == 42); - assert(p2.second == 101); - } - { - test_pair_const(); // copy construction - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); // copy construction - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); // copy construction - test_pair_const(); - test_pair_const(); - - test_pair_const(); // copy construction - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - } - - { // Test construction of references - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - // Unfortunately the below conversions are allowed and create dangling - // references. - //test_pair_const(); - //test_pair_const(); - //test_pair_const(); - // But these are not because the converting constructor is explicit. - test_pair_const(); - test_pair_const(); - test_pair_const(); - - } - { - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - - test_pair_const(); - test_pair_const(); - test_pair_const(); - test_pair_const(); - } +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P1; + typedef std::pair P2; + const P1 p1(3, 4); + const P2 p2 = p1; + assert(p2.first == 3); + assert(p2.second == 4); + } + { + // We allow derived types to use this constructor + using P1 = DPair; + using P2 = std::pair; + P1 p1(42, 101); + P2 p2(p1); + assert(p2.first == 42); + assert(p2.second == 101); + } + { + test_pair_const(); // copy construction + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); // copy construction + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); // copy construction + test_pair_const(); + test_pair_const(); + + test_pair_const(); // copy construction + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + } + + { // Test construction of references + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + // Unfortunately the below conversions are allowed and create dangling + // references. + //test_pair_const(); + //test_pair_const(); + //test_pair_const(); + // But these are not because the converting constructor is explicit. + test_pair_const(); + test_pair_const(); + test_pair_const(); + } + { + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + + test_pair_const(); + test_pair_const(); + test_pair_const(); + test_pair_const(); + } #if TEST_STD_VER > 11 { typedef std::pair P1; typedef std::pair P2; constexpr P1 p1(3, 4); constexpr P2 p2 = p1; static_assert(p2.first == 3, ""); static_assert(p2.second == 4, ""); } { using P1 = std::pair; using P2 = std::pair; constexpr P1 p1(42, 101); constexpr P2 p2(p1); static_assert(p2.first.value == 42, ""); static_assert(p2.second.value == 101, ""); } { - using P1 = std::pair; - using P2 = std::pair; - constexpr P1 p1(42, 101); - constexpr P2 p2 = p1; - static_assert(p2.first.value == 42, ""); - static_assert(p2.second.value == 101, ""); + using P1 = std::pair; + using P2 = std::pair; + constexpr P1 p1(42, 101); + constexpr P2 p2 = p1; + static_assert(p2.first.value == 42, ""); + static_assert(p2.second.value == 101, ""); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp index 203209d5e634..37bbb9501769 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp @@ -1,39 +1,45 @@ //===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 // // template struct pair // template // pair(piecewise_construct_t, tuple first_args, // tuple second_args); #include #include #include #include "test_macros.h" +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P1; + typedef std::pair P2; + typedef std::pair P3; + P3 p3(std::piecewise_construct, std::tuple(3, nullptr), + std::tuple(nullptr, 4)); + assert(p3.first == P1(3, nullptr)); + assert(p3.second == P2(nullptr, 4)); + } + return true; +} -int main(int, char**) -{ - { - typedef std::pair P1; - typedef std::pair P2; - typedef std::pair P3; - P3 p3(std::piecewise_construct, std::tuple(3, nullptr), - std::tuple(nullptr, 4)); - assert(p3.first == P1(3, nullptr)); - assert(p3.second == P2(nullptr, 4)); - } +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp index 9a497e5ac532..a2d720ff42ea 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp @@ -1,53 +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 // //===----------------------------------------------------------------------===// // // template struct pair // void swap(pair& p); #include #include #include "test_macros.h" struct S { int i; - S() : i(0) {} - S(int j) : i(j) {} - S * operator& () { assert(false); return this; } - S const * operator& () const { assert(false); return this; } - bool operator==(int x) const { return i == x; } - }; - -int main(int, char**) -{ - { - typedef std::pair P1; - P1 p1(3, static_cast(4)); - P1 p2(5, static_cast(6)); - p1.swap(p2); - assert(p1.first == 5); - assert(p1.second == 6); - assert(p2.first == 3); - assert(p2.second == 4); - } - { - typedef std::pair P1; - P1 p1(3, S(4)); - P1 p2(5, S(6)); - p1.swap(p2); - assert(p1.first == 5); - assert(p1.second == 6); - assert(p2.first == 3); - assert(p2.second == 4); - } + TEST_CONSTEXPR_CXX20 S() : i(0) {} + TEST_CONSTEXPR_CXX20 S(int j) : i(j) {} + TEST_CONSTEXPR_CXX20 bool operator==(int x) const { return i == x; } +}; + +TEST_CONSTEXPR_CXX20 bool test() { + { + typedef std::pair P1; + P1 p1(3, static_cast(4)); + P1 p2(5, static_cast(6)); + p1.swap(p2); + assert(p1.first == 5); + assert(p1.second == 6); + assert(p2.first == 3); + assert(p2.second == 4); + } + { + typedef std::pair P1; + P1 p1(3, S(4)); + P1 p2(5, S(6)); + p1.swap(p2); + assert(p1.first == 5); + assert(p1.second == 6); + assert(p2.first == 3); + assert(p2.second == 4); + } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index b77f88489d9d..88241614420a 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -1,1019 +1,1025 @@ #!/usr/bin/env python import os import tempfile from builtins import int, range from functools import reduce def get_libcxx_paths(): utils_path = os.path.dirname(os.path.abspath(__file__)) script_name = os.path.basename(__file__) assert os.path.exists(utils_path) src_root = os.path.dirname(utils_path) include_path = os.path.join(src_root, 'include') assert os.path.exists(include_path) docs_path = os.path.join(src_root, 'docs') assert os.path.exists(docs_path) macro_test_path = os.path.join(src_root, 'test', 'std', 'language.support', 'support.limits', 'support.limits.general') assert os.path.exists(macro_test_path) assert os.path.exists(os.path.join(macro_test_path, 'version.version.pass.cpp')) return script_name, src_root, include_path, docs_path, macro_test_path script_name, source_root, include_path, docs_path, macro_test_path = get_libcxx_paths() def has_header(h): h_path = os.path.join(include_path, h) return os.path.exists(h_path) def add_version_header(tc): tc["headers"].append("version") return tc feature_test_macros = sorted([ add_version_header(x) for x in [ # C++14 macros {"name": "__cpp_lib_integer_sequence", "values": { "c++14": int(201304) }, "headers": ["utility"], }, {"name": "__cpp_lib_exchange_function", "values": { "c++14": int(201304) }, "headers": ["utility"], }, {"name": "__cpp_lib_tuples_by_type", "values": { "c++14": int(201304) }, "headers": ["utility", "tuple"], }, {"name": "__cpp_lib_tuple_element_t", "values": { "c++14": int(201402) }, "headers": ["tuple"], }, {"name": "__cpp_lib_make_unique", "values": { "c++14": int(201304) }, "headers": ["memory"], }, {"name": "__cpp_lib_transparent_operators", "values": { "c++14": int(201210), "c++17": int(201510), }, "headers": ["functional"], }, {"name": "__cpp_lib_integral_constant_callable", "values": { "c++14": int(201304) }, "headers": ["type_traits"], }, {"name": "__cpp_lib_transformation_trait_aliases", "values": { "c++14": int(201304), }, "headers": ["type_traits"] }, {"name": "__cpp_lib_result_of_sfinae", "values": { "c++14": int(201210), }, "headers": ["functional", "type_traits"] }, {"name": "__cpp_lib_is_final", "values": { "c++14": int(201402), }, "headers": ["type_traits"] }, {"name": "__cpp_lib_is_null_pointer", "values": { "c++14": int(201309), }, "headers": ["type_traits"] }, {"name": "__cpp_lib_chrono_udls", "values": { "c++14": int(201304), }, "headers": ["chrono"] }, {"name": "__cpp_lib_string_udls", "values": { "c++14": int(201304), }, "headers": ["string"] }, {"name": "__cpp_lib_generic_associative_lookup", "values": { "c++14": int(201304), }, "headers": ["map", "set"] }, {"name": "__cpp_lib_null_iterators", "values": { "c++14": int(201304), }, "headers": ["iterator"] }, {"name": "__cpp_lib_make_reverse_iterator", "values": { "c++14": int(201402), }, "headers": ["iterator"] }, {"name": "__cpp_lib_robust_nonmodifying_seq_ops", "values": { "c++14": int(201304), }, "headers": ["algorithm"] }, {"name": "__cpp_lib_complex_udls", "values": { "c++14": int(201309), }, "headers": ["complex"] }, {"name": "__cpp_lib_quoted_string_io", "values": { "c++14": int(201304), }, "headers": ["iomanip"] }, {"name": "__cpp_lib_shared_timed_mutex", "values": { "c++14": int(201402), }, "headers": ["shared_mutex"], "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, # C++17 macros {"name": "__cpp_lib_atomic_is_always_lock_free", "values": { "c++17": int(201603), }, "headers": ["atomic"], "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, {"name": "__cpp_lib_filesystem", "values": { "c++17": int(201703), }, "headers": ["filesystem"] }, {"name": "__cpp_lib_invoke", "values": { "c++17": int(201411), }, "headers": ["functional"] }, {"name": "__cpp_lib_void_t", "values": { "c++17": int(201411), }, "headers": ["type_traits"] }, {"name": "__cpp_lib_node_extract", "values": { "c++17": int(201606), }, "headers": ["map", "set", "unordered_map", "unordered_set"] }, {"name": "__cpp_lib_byte", "values": { "c++17": int(201603), }, "headers": ["cstddef"], }, {"name": "__cpp_lib_hardware_interference_size", "values": { "c++17": int(201703), }, "headers": ["new"], "unimplemented": True, }, {"name": "__cpp_lib_launder", "values": { "c++17": int(201606), }, "headers": ["new"], }, {"name": "__cpp_lib_uncaught_exceptions", "values": { "c++17": int(201411), }, "headers": ["exception"], }, {"name": "__cpp_lib_as_const", "values": { "c++17": int(201510), }, "headers": ["utility"], }, {"name": "__cpp_lib_make_from_tuple", "values": { "c++17": int(201606), }, "headers": ["tuple"], }, {"name": "__cpp_lib_apply", "values": { "c++17": int(201603), }, "headers": ["tuple"], }, {"name": "__cpp_lib_optional", "values": { "c++17": int(201606), }, "headers": ["optional"], }, {"name": "__cpp_lib_variant", "values": { "c++17": int(201606), }, "headers": ["variant"], }, {"name": "__cpp_lib_any", "values": { "c++17": int(201606), }, "headers": ["any"], }, {"name": "__cpp_lib_addressof_constexpr", "values": { "c++17": int(201603), }, "headers": ["memory"], "depends": "TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700", "internal_depends": "!defined(_LIBCPP_HAS_NO_BUILTIN_ADDRESSOF)", }, {"name": "__cpp_lib_raw_memory_algorithms", "values": { "c++17": int(201606), }, "headers": ["memory"], }, {"name": "__cpp_lib_enable_shared_from_this", "values": { "c++17": int(201603), }, "headers": ["memory"], }, {"name": "__cpp_lib_shared_ptr_weak_type", "values": { "c++17": int(201606), }, "headers": ["memory"], }, {"name": "__cpp_lib_shared_ptr_arrays", "values": { "c++17": int(201611), }, "headers": ["memory"], "unimplemented": True, }, {"name": "__cpp_lib_memory_resource", "values": { "c++17": int(201603), }, "headers": ["memory_resource"], "unimplemented": True, }, {"name": "__cpp_lib_boyer_moore_searcher", "values": { "c++17": int(201603), }, "headers": ["functional"], "unimplemented": True, }, {"name": "__cpp_lib_not_fn", "values": { "c++17": int(201603), }, "headers": ["functional"], }, {"name": "__cpp_lib_bool_constant", "values": { "c++17": int(201505), }, "headers": ["type_traits"], }, {"name": "__cpp_lib_type_trait_variable_templates", "values": { "c++17": int(201510), }, "headers": ["type_traits"], }, {"name": "__cpp_lib_logical_traits", "values": { "c++17": int(201510), }, "headers": ["type_traits"], }, {"name": "__cpp_lib_is_swappable", "values": { "c++17": int(201603), }, "headers": ["type_traits"], }, {"name": "__cpp_lib_is_invocable", "values": { "c++17": int(201703), }, "headers": ["type_traits"], }, {"name": "__cpp_lib_has_unique_object_representations", "values": { "c++17": int(201606), }, "headers": ["type_traits"], "depends": "TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700", "internal_depends": "defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS)", }, {"name": "__cpp_lib_is_aggregate", "values": { "c++17": int(201703), }, "headers": ["type_traits"], "depends": "TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001", "internal_depends": "!defined(_LIBCPP_HAS_NO_IS_AGGREGATE)", }, {"name": "__cpp_lib_chrono", "values": { "c++17": int(201611), }, "headers": ["chrono"], }, {"name": "__cpp_lib_execution", "values": { "c++17": int(201603), }, "headers": ["execution"], "unimplemented": True }, {"name": "__cpp_lib_parallel_algorithm", "values": { "c++17": int(201603), }, "headers": ["algorithm", "numeric"], "unimplemented": True, }, {"name": "__cpp_lib_to_chars", "values": { "c++17": int(201611), }, "headers": ["utility"], "unimplemented": True, }, {"name": "__cpp_lib_string_view", "values": { "c++17": int(201606), }, "headers": ["string", "string_view"], }, {"name": "__cpp_lib_allocator_traits_is_always_equal", "values": { "c++17": int(201411), }, "headers": ["memory", "scoped_allocator", "string", "deque", "forward_list", "list", "vector", "map", "set", "unordered_map", "unordered_set"], }, {"name": "__cpp_lib_incomplete_container_elements", "values": { "c++17": int(201505), }, "headers": ["forward_list", "list", "vector"], }, {"name": "__cpp_lib_map_try_emplace", "values": { "c++17": int(201411), }, "headers": ["map"], }, {"name": "__cpp_lib_unordered_map_try_emplace", "values": { "c++17": int(201411), }, "headers": ["unordered_map"], }, {"name": "__cpp_lib_array_constexpr", "values": { "c++17": int(201603), "c++2a": int(201811), }, "headers": ["iterator", "array"], }, {"name": "__cpp_lib_nonmember_container_access", "values": { "c++17": int(201411), }, "headers": ["iterator", "array", "deque", "forward_list", "list", "map", "regex", "set", "string", "unordered_map", "unordered_set", "vector"], }, {"name": "__cpp_lib_sample", "values": { "c++17": int(201603), }, "headers": ["algorithm"], }, {"name": "__cpp_lib_clamp", "values": { "c++17": int(201603), }, "headers": ["algorithm"], }, {"name": "__cpp_lib_gcd_lcm", "values": { "c++17": int(201606), }, "headers": ["numeric"], }, {"name": "__cpp_lib_hypot", "values": { "c++17": int(201603), }, "headers": ["cmath"], }, {"name": "__cpp_lib_math_special_functions", "values": { "c++17": int(201603), }, "headers": ["cmath"], "unimplemented": True, }, {"name": "__cpp_lib_shared_mutex", "values": { "c++17": int(201505), }, "headers": ["shared_mutex"], "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, {"name": "__cpp_lib_scoped_lock", "values": { "c++17": int(201703), }, "headers": ["mutex"], }, # C++2a {"name": "__cpp_lib_char8_t", "values": { "c++2a": int(201811), }, "headers": ["atomic", "filesystem", "istream", "limits", "locale", "ostream", "string", "string_view"], "depends": "defined(__cpp_char8_t)", "internal_depends": "!defined(_LIBCPP_NO_HAS_CHAR8_T)", }, {"name": "__cpp_lib_erase_if", "values": { "c++2a": int(202002), }, "headers": ["string", "deque", "forward_list", "list", "vector", "map", "set", "unordered_map", "unordered_set"] }, {"name": "__cpp_lib_destroying_delete", "values": { "c++2a": int(201806), }, "headers": ["new"], "depends": "TEST_STD_VER > 17" " && defined(__cpp_impl_destroying_delete)" " && __cpp_impl_destroying_delete >= 201806L", "internal_depends": "_LIBCPP_STD_VER > 17" " && defined(__cpp_impl_destroying_delete)" " && __cpp_impl_destroying_delete >= 201806L", }, {"name": "__cpp_lib_three_way_comparison", "values": { "c++2a": int(201711), }, "headers": ["compare"], "unimplemented": True, }, {"name": "__cpp_lib_concepts", "values": { "c++2a": int(201806), }, "headers": ["concepts"], "unimplemented": True, }, {"name": "__cpp_lib_constexpr_swap_algorithms", "values": { "c++2a": int(201806), }, "headers": ["algorithm"], "unimplemented": True, }, {"name": "__cpp_lib_constexpr_misc", "values": { "c++2a": int(201811), }, "headers": ["array", "functional", "iterator", "string_view", "tuple", "utility"], "unimplemented": True, }, {"name": "__cpp_lib_bind_front", "values": { "c++2a": int(201811), }, "headers": ["functional"], "unimplemented": True, }, {"name": "__cpp_lib_is_constant_evaluated", "values": { "c++2a": int(201811), }, "headers": ["type_traits"], "depends": "TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900", "internal_depends": "!defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)", }, {"name": "__cpp_lib_list_remove_return_type", "values": { "c++2a": int(201806), }, "headers": ["forward_list", "list"], }, {"name": "__cpp_lib_generic_unordered_lookup", "values": { "c++2a": int(201811), }, "headers": ["unordered_map", "unordered_set"], "unimplemented": True, }, {"name": "__cpp_lib_ranges", "values": { "c++2a": int(201811), }, "headers": ["algorithm", "functional", "iterator", "memory", "ranges"], "unimplemented": True, }, {"name": "__cpp_lib_bit_cast", "values": { "c++2a": int(201806), }, "headers": ["bit"], "unimplemented": True, }, {"name": "__cpp_lib_atomic_ref", "values": { "c++2a": int(201806), }, "headers": ["atomic"], "unimplemented": True, "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, {"name": "__cpp_lib_interpolate", "values": { "c++2a": int(201902), }, "headers": ["numeric"], }, {"name": "__cpp_lib_endian", "values": { "c++2a": int(201907), }, "headers": ["bit"], }, {"name": "__cpp_lib_to_array", "values": { "c++2a": int(201907), }, "headers": ["array"], }, {"name": "__cpp_lib_span", "values": { "c++2a": int(202002), }, "headers": ["span"], }, {"name": "__cpp_lib_math_constants", "values": { "c++2a": int(201907), }, "headers": ["numbers"], "depends": "defined(__cpp_concepts) && __cpp_concepts >= 201811L", "internal_depends": "defined(__cpp_concepts) && __cpp_concepts >= 201811L", }, + {"name": "__cpp_lib_constexpr_utility ", + "values": { + "c++2a": int(201811), + }, + "headers": ["utility"], + }, ]], key=lambda tc: tc["name"]) def get_std_dialects(): std_dialects = ['c++14', 'c++17', 'c++2a'] return list(std_dialects) def get_first_std(d): for s in get_std_dialects(): if s in d.keys(): return s return None def get_last_std(d): rev_dialects = get_std_dialects() rev_dialects.reverse() for s in rev_dialects: if s in d.keys(): return s return None def get_std_before(d, std): std_dialects = get_std_dialects() candidates = std_dialects[0:std_dialects.index(std)] candidates.reverse() for cand in candidates: if cand in d.keys(): return cand return None def get_value_before(d, std): new_std = get_std_before(d, std) if new_std is None: return None return d[new_std] def get_for_std(d, std): # This catches the C++11 case for which there should be no defined feature # test macros. std_dialects = get_std_dialects() if std not in std_dialects: return None # Find the value for the newest C++ dialect between C++14 and std std_list = list(std_dialects[0:std_dialects.index(std)+1]) std_list.reverse() for s in std_list: if s in d.keys(): return d[s] return None """ Functions to produce the header """ def produce_macros_definition_for_std(std): result = "" indent = 56 for tc in feature_test_macros: if std not in tc["values"]: continue inner_indent = 1 if 'depends' in tc.keys(): assert 'internal_depends' in tc.keys() result += "# if %s\n" % tc["internal_depends"] inner_indent += 2 if get_value_before(tc["values"], std) is not None: assert 'depends' not in tc.keys() result += "# undef %s\n" % tc["name"] line = "#%sdefine %s" % ((" " * inner_indent), tc["name"]) line += " " * (indent - len(line)) line += "%sL" % tc["values"][std] if 'unimplemented' in tc.keys(): line = "// " + line result += line result += "\n" if 'depends' in tc.keys(): result += "# endif\n" return result def chunks(l, n): """Yield successive n-sized chunks from l.""" for i in range(0, len(l), n): yield l[i:i + n] def produce_version_synopsis(): indent = 56 header_indent = 56 + len("20XXYYL ") result = "" def indent_to(s, val): if len(s) >= val: return s s += " " * (val - len(s)) return s line = indent_to("Macro name", indent) + "Value" line = indent_to(line, header_indent) + "Headers" result += line + "\n" for tc in feature_test_macros: prev_defined_std = get_last_std(tc["values"]) line = "{name: <{indent}}{value}L ".format(name=tc['name'], indent=indent, value=tc["values"][prev_defined_std]) headers = list(tc["headers"]) headers.remove("version") for chunk in chunks(headers, 3): line = indent_to(line, header_indent) chunk = ['<%s>' % header for header in chunk] line += ' '.join(chunk) result += line result += "\n" line = "" while True: prev_defined_std = get_std_before(tc["values"], prev_defined_std) if prev_defined_std is None: break result += "%s%sL // %s\n" % (indent_to("", indent), tc["values"][prev_defined_std], prev_defined_std.replace("c++", "C++")) return result def produce_version_header(): template="""// -*- C++ -*- //===--------------------------- version ----------------------------------===// // // 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_VERSIONH #define _LIBCPP_VERSIONH /* version synopsis {synopsis} */ #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if _LIBCPP_STD_VER > 11 {cxx14_macros} #endif #if _LIBCPP_STD_VER > 14 {cxx17_macros} #endif #if _LIBCPP_STD_VER > 17 {cxx2a_macros} #endif #endif // _LIBCPP_VERSIONH """ return template.format( synopsis=produce_version_synopsis().strip(), cxx14_macros=produce_macros_definition_for_std('c++14').strip(), cxx17_macros=produce_macros_definition_for_std('c++17').strip(), cxx2a_macros=produce_macros_definition_for_std('c++2a').strip()) """ Functions to produce test files """ test_types = { "undefined": """ # ifdef {name} # error "{name} should not be defined before {std_first}" # endif """, "depends": """ # if {depends} # ifndef {name} # error "{name} should be defined in {std}" # endif # if {name} != {value} # error "{name} should have the value {value} in {std}" # endif # else # ifdef {name} # error "{name} should not be defined when {depends} is not defined!" # endif # endif """, "unimplemented": """ # if !defined(_LIBCPP_VERSION) # ifndef {name} # error "{name} should be defined in {std}" # endif # if {name} != {value} # error "{name} should have the value {value} in {std}" # endif # else // _LIBCPP_VERSION # ifdef {name} # error "{name} should not be defined because it is unimplemented in libc++!" # endif # endif """, "defined":""" # ifndef {name} # error "{name} should be defined in {std}" # endif # if {name} != {value} # error "{name} should have the value {value} in {std}" # endif """ } def generate_std_test(test_list, std): result = "" for tc in test_list: val = get_for_std(tc["values"], std) if val is not None: val = "%sL" % val if val is None: result += test_types["undefined"].format(name=tc["name"], std_first=get_first_std(tc["values"])) elif 'unimplemented' in tc.keys(): result += test_types["unimplemented"].format(name=tc["name"], value=val, std=std) elif "depends" in tc.keys(): result += test_types["depends"].format(name=tc["name"], value=val, std=std, depends=tc["depends"]) else: result += test_types["defined"].format(name=tc["name"], value=val, std=std) return result def generate_synopsis(test_list): max_name_len = max([len(tc["name"]) for tc in test_list]) indent = max_name_len + 8 def mk_line(prefix, suffix): return "{prefix: <{max_len}}{suffix}\n".format(prefix=prefix, suffix=suffix, max_len=indent) result = "" result += mk_line("/* Constant", "Value") for tc in test_list: prefix = " %s" % tc["name"] for std in [s for s in get_std_dialects() if s in tc["values"].keys()]: result += mk_line(prefix, "%sL [%s]" % (tc["values"][std], std.replace("c++", "C++"))) prefix = "" result += "*/" return result def is_threading_header_unsafe_to_include(h): # NOTE: "" does not blow up when included without threads. return h in ['atomic', 'shared_mutex'] def produce_tests(): headers = set([h for tc in feature_test_macros for h in tc["headers"]]) for h in headers: test_list = [tc for tc in feature_test_macros if h in tc["headers"]] if not has_header(h): for tc in test_list: assert 'unimplemented' in tc.keys() continue test_tags = "" if is_threading_header_unsafe_to_include(h): test_tags += '\n// UNSUPPORTED: libcpp-has-no-threads\n' test_body = \ """//===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // WARNING: This test was generated by {script_name} // and should not be edited manually. {test_tags} // <{header}> // Test the feature test macros defined by <{header}> {synopsis} #include <{header}> #include "test_macros.h" #if TEST_STD_VER < 14 {cxx11_tests} #elif TEST_STD_VER == 14 {cxx14_tests} #elif TEST_STD_VER == 17 {cxx17_tests} #elif TEST_STD_VER > 17 {cxx2a_tests} #endif // TEST_STD_VER > 17 int main(int, char**) {{ return 0; }} """.format(script_name=script_name, header=h, test_tags=test_tags, synopsis=generate_synopsis(test_list), cxx11_tests=generate_std_test(test_list, 'c++11').strip(), cxx14_tests=generate_std_test(test_list, 'c++14').strip(), cxx17_tests=generate_std_test(test_list, 'c++17').strip(), cxx2a_tests=generate_std_test(test_list, 'c++2a').strip()) test_name = "{header}.version.pass.cpp".format(header=h) out_path = os.path.join(macro_test_path, test_name) with open(out_path, 'w') as f: f.write(test_body) """ Produce documentation for the feature test macros """ def make_widths(grid): widths = [] for i in range(0, len(grid[0])): cell_width = 2 + max(reduce(lambda x,y: x+y, [[len(row[i])] for row in grid], [])) widths += [cell_width] return widths def create_table(grid, indent): indent_str = ' '*indent col_widths = make_widths(grid) num_cols = len(grid[0]) result = indent_str + add_divider(col_widths, 2) header_flag = 2 for row_i in range(0, len(grid)): row = grid[row_i] result = result + indent_str + ' '.join([pad_cell(row[i], col_widths[i]) for i in range(0, len(row))]) + '\n' is_cxx_header = row[0].startswith('**') if row_i == len(grid) - 1: header_flag = 2 result = result + indent_str + add_divider(col_widths, 1 if is_cxx_header else header_flag) header_flag = 0 return result def add_divider(widths, header_flag): if header_flag == 2: return ' '.join(['='*w for w in widths]) + '\n' if header_flag == 1: return '-'.join(['-'*w for w in widths]) + '\n' else: return ' '.join(['-'*w for w in widths]) + '\n' def pad_cell(s, length, left_align=True): padding = ((length - len(s)) * ' ') return s + padding def get_status_table(): table = [["Macro Name", "Value"]] for std in get_std_dialects(): table += [["**" + std.replace("c++", "C++ ") + "**", ""]] for tc in feature_test_macros: if std not in tc["values"].keys(): continue value = "``%sL``" % tc["values"][std] if 'unimplemented' in tc.keys(): value = '*unimplemented*' table += [["``%s``" % tc["name"], value]] return table def produce_docs(): doc_str = """.. _FeatureTestMacroTable: ========================== Feature Test Macro Support ========================== .. contents:: :local: Overview ======== This file documents the feature test macros currently supported by libc++. .. _feature-status: Status ====== .. table:: Current Status :name: feature-status-table :widths: auto {status_tables} """.format(status_tables=create_table(get_status_table(), 4)) table_doc_path = os.path.join(docs_path, 'FeatureTestMacroTable.rst') with open(table_doc_path, 'w') as f: f.write(doc_str) def main(): with tempfile.NamedTemporaryFile(mode='w', prefix='version.', delete=False) as tmp_file: print("producing new header as %s" % tmp_file.name) tmp_file.write(produce_version_header()) produce_tests() produce_docs() if __name__ == '__main__': main()