From ddfbef12b81926be3f2eecf31222ad6eaca6a29a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Sep 2017 14:24:50 +0200 Subject: compat: add compatibility layer for value templates --- compat/value-templates.hpp | 192 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 compat/value-templates.hpp (limited to 'compat/value-templates.hpp') diff --git a/compat/value-templates.hpp b/compat/value-templates.hpp new file mode 100644 index 00000000..0764b1ab --- /dev/null +++ b/compat/value-templates.hpp @@ -0,0 +1,192 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +#if __cplusplus < 201703L + +template constexpr bool is_void_v = std::is_void::value; +template constexpr bool is_null_pointer_v = std::is_null_pointer::value; +template constexpr bool is_integral_v = std::is_integral::value; +template constexpr bool is_floating_point_v = std::is_floating_point::value; +template constexpr bool is_array_v = std::is_array::value; +template constexpr bool is_pointer_v = std::is_pointer::value; +template constexpr bool is_lvalue_reference_v = std::is_lvalue_reference::value; +template constexpr bool is_rvalue_reference_v = std::is_rvalue_reference::value; +template constexpr bool is_member_object_pointer_v = std::is_member_object_pointer::value; +template constexpr bool is_member_function_pointer_v = std::is_member_function_pointer::value; +template constexpr bool is_enum_v = std::is_enum::value; +template constexpr bool is_union_v = std::is_union::value; +template constexpr bool is_class_v = std::is_class::value; +template constexpr bool is_function_v = std::is_function::value; + +template constexpr bool is_reference_v = std::is_reference::value; +template constexpr bool is_arithmetic_v = std::is_arithmetic::value; +template constexpr bool is_fundamental_v = std::is_fundamental::value; +template constexpr bool is_object_v = std::is_object::value; +template constexpr bool is_scalar_v = std::is_scalar::value; +template constexpr bool is_compound_v = std::is_compound::value; +template constexpr bool is_member_pointer_v = std::is_member_pointer::value; + +template constexpr bool is_const_v = std::is_const::value; +template constexpr bool is_volatile_v = std::is_volatile::value; +template constexpr bool is_trivial_v = std::is_trivial::value; +template constexpr bool is_trivially_copyable_v = std::is_trivially_copyable::value; +template constexpr bool is_standard_layout_v = std::is_standard_layout::value; +template constexpr bool is_pod_v = std::is_pod::value; +template constexpr bool is_literal_type_v = std::is_literal_type::value; +template constexpr bool is_empty_v = std::is_empty::value; +template constexpr bool is_polymorphic_v = std::is_polymorphic::value; +template constexpr bool is_abstract_v = std::is_abstract::value; +template constexpr bool is_final_v = std::is_final::value; +template constexpr bool is_signed_v = std::is_signed::value; +template constexpr bool is_unsigned_v = std::is_unsigned::value; + +template constexpr bool is_constructible_v = std::is_constructible::value; +template constexpr bool is_trivially_constructible_v = std::is_trivially_constructible::value; +template constexpr bool is_nothrow_constructible_v = std::is_nothrow_constructible::value; +template constexpr bool is_default_constructible_v = std::is_default_constructible::value; +template constexpr bool is_trivially_default_constructible_v = std::is_trivially_default_constructible::value; +template constexpr bool is_nothrow_default_constructible_v = std::is_nothrow_default_constructible::value; +template constexpr bool is_copy_constructible_v = std::is_copy_constructible::value; +template constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible::value; +template constexpr bool is_nothrow_copy_constructible_v = std::is_nothrow_copy_constructible::value; +template constexpr bool is_move_constructible_v = std::is_move_constructible::value; +template constexpr bool is_trivially_move_constructible_v = std::is_trivially_move_constructible::value; +template constexpr bool is_nothrow_move_constructible_v = std::is_nothrow_move_constructible::value; +template constexpr bool is_assignable_v = std::is_assignable::value; +template constexpr bool is_trivially_assignable_v = std::is_trivially_assignable::value; +template constexpr bool is_nothrow_assignable_v = std::is_nothrow_assignable::value; +template constexpr bool is_copy_assignable_v = std::is_copy_assignable::value; +template constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable::value; +template constexpr bool is_nothrow_copy_assignable_v = std::is_nothrow_copy_assignable::value; +template constexpr bool is_move_assignable_v = std::is_move_assignable::value; +template constexpr bool is_trivially_move_assignable_v = std::is_trivially_move_assignable::value; +template constexpr bool is_nothrow_move_assignable_v = std::is_nothrow_move_assignable::value; +template constexpr bool is_destructible_v = std::is_destructible::value; +template constexpr bool is_trivially_destructible_v = std::is_trivially_destructible::value; +template constexpr bool is_nothrow_destructible_v = std::is_nothrow_destructible::value; +template constexpr bool has_virtual_destructor_v = std::has_virtual_destructor::value; + +template constexpr std::size_t alignment_of_v = std::alignment_of::value; +template constexpr std::size_t rank_v = std::rank::value; +template constexpr std::size_t extent_v = std::extent::value; + +template constexpr bool is_same_v = std::is_same::value; +template constexpr bool is_base_of_v = std::is_base_of::value; +template constexpr bool is_convertible_v = std::is_convertible::value; + +template constexpr bool ratio_equal_v = std::ratio_equal::value; +template constexpr bool ratio_not_equal_v = std::ratio_not_equal::value; +template constexpr bool ratio_less_v = std::ratio_less::value; +template constexpr bool ratio_less_equal_v = std::ratio_less_equal::value; +template constexpr bool ratio_greater_v = std::ratio_greater::value; +template constexpr bool ratio_greater_equal_v = std::ratio_greater_equal::value; + +template constexpr std::size_t tuple_size_v = std::tuple_size::value; +template constexpr bool treat_as_floating_point_v = std::chrono::treat_as_floating_point::value; + +template constexpr bool is_error_code_enum_v = std::is_error_code_enum::value; +template constexpr bool is_error_condition_enum_v = std::is_error_condition_enum::value; + +template constexpr bool is_bind_expression_v = std::is_bind_expression::value; +template constexpr bool is_placeholder_v = std::is_placeholder::value; + +template constexpr bool uses_allocator_v = std::uses_allocator::value; + +#else + +template constexpr bool is_void_v = std::is_void_v; +template constexpr bool is_null_pointer_v = std::is_null_pointer_v; +template constexpr bool is_integral_v = std::is_integral_v; +template constexpr bool is_floating_point_v = std::is_floating_point_v; +template constexpr bool is_array_v = std::is_array_v; +template constexpr bool is_pointer_v = std::is_pointer_v; +template constexpr bool is_lvalue_reference_v = std::is_lvalue_reference_v; +template constexpr bool is_rvalue_reference_v = std::is_rvalue_reference_v; +template constexpr bool is_member_object_pointer_v = std::is_member_object_pointer_v; +template constexpr bool is_member_function_pointer_v = std::is_member_function_pointer_v; +template constexpr bool is_enum_v = std::is_enum_v; +template constexpr bool is_union_v = std::is_union_v; +template constexpr bool is_class_v = std::is_class_v; +template constexpr bool is_function_v = std::is_function_v; + +template constexpr bool is_reference_v = std::is_reference_v; +template constexpr bool is_arithmetic_v = std::is_arithmetic_v; +template constexpr bool is_fundamental_v = std::is_fundamental_v; +template constexpr bool is_object_v = std::is_object_v; +template constexpr bool is_scalar_v = std::is_scalar_v; +template constexpr bool is_compound_v = std::is_compound_v; +template constexpr bool is_member_pointer_v = std::is_member_pointer_v; + +template constexpr bool is_const_v = std::is_const_v; +template constexpr bool is_volatile_v = std::is_volatile_v; +template constexpr bool is_trivial_v = std::is_trivial_v; +template constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; +template constexpr bool is_standard_layout_v = std::is_standard_layout_v; +template constexpr bool is_pod_v = std::is_pod_v; +template constexpr bool is_literal_type_v = std::is_literal_type_v; +template constexpr bool is_empty_v = std::is_empty_v; +template constexpr bool is_polymorphic_v = std::is_polymorphic_v; +template constexpr bool is_abstract_v = std::is_abstract_v; +template constexpr bool is_final_v = std::is_final_v; +template constexpr bool is_signed_v = std::is_signed_v; +template constexpr bool is_unsigned_v = std::is_unsigned_v; + +template constexpr bool is_constructible_v = std::is_constructible_v; +template constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; +template constexpr bool is_nothrow_constructible_v = std::is_nothrow_constructible_v; +template constexpr bool is_default_constructible_v = std::is_default_constructible_v; +template constexpr bool is_trivially_default_constructible_v = std::is_trivially_default_constructible_v; +template constexpr bool is_nothrow_default_constructible_v = std::is_nothrow_default_constructible_v; +template constexpr bool is_copy_constructible_v = std::is_copy_constructible_v; +template constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; +template constexpr bool is_nothrow_copy_constructible_v = std::is_nothrow_copy_constructible_v; +template constexpr bool is_move_constructible_v = std::is_move_constructible_v; +template constexpr bool is_trivially_move_constructible_v = std::is_trivially_move_constructible_v; +template constexpr bool is_nothrow_move_constructible_v = std::is_nothrow_move_constructible_v; +template constexpr bool is_assignable_v = std::is_assignable_v; +template constexpr bool is_trivially_assignable_v = std::is_trivially_assignable_v; +template constexpr bool is_nothrow_assignable_v = std::is_nothrow_assignable_v; +template constexpr bool is_copy_assignable_v = std::is_copy_assignable_v; +template constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; +template constexpr bool is_nothrow_copy_assignable_v = std::is_nothrow_copy_assignable_v; +template constexpr bool is_move_assignable_v = std::is_move_assignable_v; +template constexpr bool is_trivially_move_assignable_v = std::is_trivially_move_assignable_v; +template constexpr bool is_nothrow_move_assignable_v = std::is_nothrow_move_assignable_v; +template constexpr bool is_destructible_v = std::is_destructible_v; +template constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; +template constexpr bool is_nothrow_destructible_v = std::is_nothrow_destructible_v; +template constexpr bool has_virtual_destructor_v = std::has_virtual_destructor_v; + +template constexpr std::size_t alignment_of_v = std::alignment_of_v; +template constexpr std::size_t rank_v = std::rank_v; +template constexpr std::size_t extent_v = std::extent_v; + +template constexpr bool is_same_v = std::is_same_v; +template constexpr bool is_base_of_v = std::is_base_of_v; +template constexpr bool is_convertible_v = std::is_convertible_v; + +template constexpr bool ratio_equal_v = std::ratio_equal_v; +template constexpr bool ratio_not_equal_v = std::ratio_not_equal_v; +template constexpr bool ratio_less_v = std::ratio_less_v; +template constexpr bool ratio_less_equal_v = std::ratio_less_equal_v; +template constexpr bool ratio_greater_v = std::ratio_greater_v; +template constexpr bool ratio_greater_equal_v = std::ratio_greater_equal_v; + +template constexpr std::size_t tuple_size_v = std::tuple_size_v; +template constexpr bool treat_as_floating_point_v = std::chrono::treat_as_floating_point_v; + +template constexpr bool is_error_code_enum_v = std::is_error_code_enum_v; +template constexpr bool is_error_condition_enum_v = std::is_error_condition_enum_v; + +template constexpr bool is_bind_expression_v = std::is_bind_expression_v; +template constexpr bool is_placeholder_v = std::is_placeholder_v; + +template constexpr bool uses_allocator_v = std::uses_allocator_v; + +#endif -- cgit v1.2.3