// -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_TYPE_TRAITS #define _LIBCPP_TYPE_TRAITS /* type_traits synopsis namespace std { // helper class: template struct integral_constant; typedef integral_constant true_type; // C++11 typedef integral_constant false_type; // C++11 template // C++14 using bool_constant = integral_constant; // C++14 typedef bool_constant true_type; // C++14 typedef bool_constant false_type; // C++14 // helper traits template struct enable_if; template struct conditional; // Primary classification traits: template struct is_void; template struct is_null_pointer; // C++14 template struct is_integral; template struct is_floating_point; template struct is_array; template struct is_pointer; template struct is_lvalue_reference; template struct is_rvalue_reference; template struct is_member_object_pointer; template struct is_member_function_pointer; template struct is_enum; template struct is_union; template struct is_class; template struct is_function; // Secondary classification traits: template struct is_reference; template struct is_arithmetic; template struct is_fundamental; template struct is_member_pointer; template struct is_scoped_enum; // C++2b template struct is_scalar; template struct is_object; template struct is_compound; // Const-volatile properties and transformations: template struct is_const; template struct is_volatile; template struct remove_const; template struct remove_volatile; template struct remove_cv; template struct add_const; template struct add_volatile; template struct add_cv; // Reference transformations: template struct remove_reference; template struct add_lvalue_reference; template struct add_rvalue_reference; // Pointer transformations: template struct remove_pointer; template struct add_pointer; template struct type_identity; // C++20 template using type_identity_t = typename type_identity::type; // C++20 // Integral properties: template struct is_signed; template struct is_unsigned; template struct make_signed; template struct make_unsigned; // Array properties and transformations: template struct rank; template struct extent; template struct remove_extent; template struct remove_all_extents; template struct is_bounded_array; // C++20 template struct is_unbounded_array; // C++20 // Member introspection: template struct is_pod; template struct is_trivial; template struct is_trivially_copyable; template struct is_standard_layout; template struct is_literal_type; // Deprecated in C++17; removed in C++20 template struct is_empty; template struct is_polymorphic; template struct is_abstract; template struct is_final; // C++14 template struct is_aggregate; // C++17 template struct is_constructible; template struct is_default_constructible; template struct is_copy_constructible; template struct is_move_constructible; template struct is_assignable; template struct is_copy_assignable; template struct is_move_assignable; template struct is_swappable_with; // C++17 template struct is_swappable; // C++17 template struct is_destructible; template struct is_trivially_constructible; template struct is_trivially_default_constructible; template struct is_trivially_copy_constructible; template struct is_trivially_move_constructible; template struct is_trivially_assignable; template struct is_trivially_copy_assignable; template struct is_trivially_move_assignable; template struct is_trivially_destructible; template struct is_nothrow_constructible; template struct is_nothrow_default_constructible; template struct is_nothrow_copy_constructible; template struct is_nothrow_move_constructible; template struct is_nothrow_assignable; template struct is_nothrow_copy_assignable; template struct is_nothrow_move_assignable; template struct is_nothrow_swappable_with; // C++17 template struct is_nothrow_swappable; // C++17 template struct is_nothrow_destructible; template struct has_virtual_destructor; template struct has_unique_object_representations; // C++17 // Relationships between types: template struct is_same; template struct is_base_of; template struct is_convertible; template struct is_nothrow_convertible; // C++20 template inline constexpr bool is_nothrow_convertible_v; // C++20 template struct is_invocable; template struct is_invocable_r; template struct is_nothrow_invocable; template struct is_nothrow_invocable_r; // Alignment properties and transformations: template struct alignment_of; template struct aligned_storage; template struct aligned_union; template struct remove_cvref; // C++20 template struct decay; template struct common_type; template struct underlying_type; template class result_of; // undefined; deprecated in C++17; removed in C++20 template class result_of; // deprecated in C++17; removed in C++20 template struct invoke_result; // C++17 // const-volatile modifications: template using remove_const_t = typename remove_const::type; // C++14 template using remove_volatile_t = typename remove_volatile::type; // C++14 template using remove_cv_t = typename remove_cv::type; // C++14 template using add_const_t = typename add_const::type; // C++14 template using add_volatile_t = typename add_volatile::type; // C++14 template using add_cv_t = typename add_cv::type; // C++14 // reference modifications: template using remove_reference_t = typename remove_reference::type; // C++14 template using add_lvalue_reference_t = typename add_lvalue_reference::type; // C++14 template using add_rvalue_reference_t = typename add_rvalue_reference::type; // C++14 // sign modifications: template using make_signed_t = typename make_signed::type; // C++14 template using make_unsigned_t = typename make_unsigned::type; // C++14 // array modifications: template using remove_extent_t = typename remove_extent::type; // C++14 template using remove_all_extents_t = typename remove_all_extents::type; // C++14 template inline constexpr bool is_bounded_array_v = is_bounded_array::value; // C++20 inline constexpr bool is_unbounded_array_v = is_unbounded_array::value; // C++20 // pointer modifications: template using remove_pointer_t = typename remove_pointer::type; // C++14 template using add_pointer_t = typename add_pointer::type; // C++14 // other transformations: template using aligned_storage_t = typename aligned_storage::type; // C++14 template using aligned_union_t = typename aligned_union::type; // C++14 template using remove_cvref_t = typename remove_cvref::type; // C++20 template using decay_t = typename decay::type; // C++14 template using enable_if_t = typename enable_if::type; // C++14 template using conditional_t = typename conditional::type; // C++14 template using common_type_t = typename common_type::type; // C++14 template using underlying_type_t = typename underlying_type::type; // C++14 template using result_of_t = typename result_of::type; // C++14; deprecated in C++17; removed in C++20 template using invoke_result_t = typename invoke_result::type; // C++17 template using void_t = void; // C++17 // See C++14 20.10.4.1, primary type categories template inline constexpr bool is_void_v = is_void::value; // C++17 template inline constexpr bool is_null_pointer_v = is_null_pointer::value; // C++17 template inline constexpr bool is_integral_v = is_integral::value; // C++17 template inline constexpr bool is_floating_point_v = is_floating_point::value; // C++17 template inline constexpr bool is_array_v = is_array::value; // C++17 template inline constexpr bool is_pointer_v = is_pointer::value; // C++17 template inline constexpr bool is_lvalue_reference_v = is_lvalue_reference::value; // C++17 template inline constexpr bool is_rvalue_reference_v = is_rvalue_reference::value; // C++17 template inline constexpr bool is_member_object_pointer_v = is_member_object_pointer::value; // C++17 template inline constexpr bool is_member_function_pointer_v = is_member_function_pointer::value; // C++17 template inline constexpr bool is_enum_v = is_enum::value; // C++17 template inline constexpr bool is_union_v = is_union::value; // C++17 template inline constexpr bool is_class_v = is_class::value; // C++17 template inline constexpr bool is_function_v = is_function::value; // C++17 // See C++14 20.10.4.2, composite type categories template inline constexpr bool is_reference_v = is_reference::value; // C++17 template inline constexpr bool is_arithmetic_v = is_arithmetic::value; // C++17 template inline constexpr bool is_fundamental_v = is_fundamental::value; // C++17 template inline constexpr bool is_object_v = is_object::value; // C++17 template inline constexpr bool is_scalar_v = is_scalar::value; // C++17 template inline constexpr bool is_compound_v = is_compound::value; // C++17 template inline constexpr bool is_member_pointer_v = is_member_pointer::value; // C++17 template inline constexpr bool is_scoped_enum_v = is_scoped_enum::value; // C++2b // See C++14 20.10.4.3, type properties template inline constexpr bool is_const_v = is_const::value; // C++17 template inline constexpr bool is_volatile_v = is_volatile::value; // C++17 template inline constexpr bool is_trivial_v = is_trivial::value; // C++17 template inline constexpr bool is_trivially_copyable_v = is_trivially_copyable::value; // C++17 template inline constexpr bool is_standard_layout_v = is_standard_layout::value; // C++17 template inline constexpr bool is_pod_v = is_pod::value; // C++17 template inline constexpr bool is_literal_type_v = is_literal_type::value; // C++17; deprecated in C++17; removed in C++20 template inline constexpr bool is_empty_v = is_empty::value; // C++17 template inline constexpr bool is_polymorphic_v = is_polymorphic::value; // C++17 template inline constexpr bool is_abstract_v = is_abstract::value; // C++17 template inline constexpr bool is_final_v = is_final::value; // C++17 template inline constexpr bool is_aggregate_v = is_aggregate::value; // C++17 template inline constexpr bool is_signed_v = is_signed::value; // C++17 template inline constexpr bool is_unsigned_v = is_unsigned::value; // C++17 template inline constexpr bool is_constructible_v = is_constructible::value; // C++17 template inline constexpr bool is_default_constructible_v = is_default_constructible::value; // C++17 template inline constexpr bool is_copy_constructible_v = is_copy_constructible::value; // C++17 template inline constexpr bool is_move_constructible_v = is_move_constructible::value; // C++17 template inline constexpr bool is_assignable_v = is_assignable::value; // C++17 template inline constexpr bool is_copy_assignable_v = is_copy_assignable::value; // C++17 template inline constexpr bool is_move_assignable_v = is_move_assignable::value; // C++17 template inline constexpr bool is_swappable_with_v = is_swappable_with::value; // C++17 template inline constexpr bool is_swappable_v = is_swappable::value; // C++17 template inline constexpr bool is_destructible_v = is_destructible::value; // C++17 template inline constexpr bool is_trivially_constructible_v = is_trivially_constructible::value; // C++17 template inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible::value; // C++17 template inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible::value; // C++17 template inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible::value; // C++17 template inline constexpr bool is_trivially_assignable_v = is_trivially_assignable::value; // C++17 template inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable::value; // C++17 template inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable::value; // C++17 template inline constexpr bool is_trivially_destructible_v = is_trivially_destructible::value; // C++17 template inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible::value; // C++17 template inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible::value; // C++17 template inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible::value; // C++17 template inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible::value; // C++17 template inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable::value; // C++17 template inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable::value; // C++17 template inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable::value; // C++17 template inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with::value; // C++17 template inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable::value; // C++17 template inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible::value; // C++17 template inline constexpr bool has_virtual_destructor_v = has_virtual_destructor::value; // C++17 template inline constexpr bool has_unique_object_representations_v // C++17 = has_unique_object_representations::value; // See C++14 20.10.5, type property queries template inline constexpr size_t alignment_of_v = alignment_of::value; // C++17 template inline constexpr size_t rank_v = rank::value; // C++17 template inline constexpr size_t extent_v = extent::value; // C++17 // See C++14 20.10.6, type relations template inline constexpr bool is_same_v = is_same::value; // C++17 template inline constexpr bool is_base_of_v = is_base_of::value; // C++17 template inline constexpr bool is_convertible_v = is_convertible::value; // C++17 template inline constexpr bool is_invocable_v = is_invocable::value; // C++17 template inline constexpr bool is_invocable_r_v = is_invocable_r::value; // C++17 template inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable::value; // C++17 template inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r::value; // C++17 // [meta.logical], logical operator traits: template struct conjunction; // C++17 template inline constexpr bool conjunction_v = conjunction::value; // C++17 template struct disjunction; // C++17 template inline constexpr bool disjunction_v = disjunction::value; // C++17 template struct negation; // C++17 template inline constexpr bool negation_v = negation::value; // C++17 } */ #include <__config> #include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS pair; template class _LIBCPP_TEMPLATE_VIS reference_wrapper; template struct _LIBCPP_TEMPLATE_VIS hash; template struct _LIBCPP_TEMPLATE_VIS integral_constant { static _LIBCPP_CONSTEXPR const _Tp value = __v; typedef _Tp value_type; typedef integral_constant type; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;} #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY constexpr value_type operator ()() const _NOEXCEPT {return value;} #endif }; template _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; #if _LIBCPP_STD_VER > 14 template using bool_constant = integral_constant; #define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)> #else #define _LIBCPP_BOOL_CONSTANT(__b) integral_constant #endif template struct _LIBCPP_TEMPLATE_VIS enable_if {}; template struct _LIBCPP_TEMPLATE_VIS enable_if {typedef _Tp type;}; template using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type; #if _LIBCPP_STD_VER > 11 template using enable_if_t = typename enable_if<_Bp, _Tp>::type; #endif typedef _LIBCPP_BOOL_CONSTANT(true) true_type; typedef _LIBCPP_BOOL_CONSTANT(false) false_type; template using _BoolConstant _LIBCPP_NODEBUG = integral_constant; template struct _MetaBase; template <> struct _MetaBase { template using _SelectImpl _LIBCPP_NODEBUG = _Tp; template