From 8b40dfd184f43a6da2933b7258a178137ec2d648 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Mon, 6 Jan 2014 22:45:41 +0900 Subject: [PATCH] add type_traits/std_value_variables.hpp --- sprout/config/auto_config.hpp | 9 ++ sprout/config/compiler/borland.hpp | 1 + sprout/config/compiler/clang.hpp | 2 + sprout/config/compiler/codegear.hpp | 1 + sprout/config/compiler/common_edg.hpp | 1 + sprout/config/compiler/digitalmars.hpp | 1 + sprout/config/compiler/gcc.hpp | 1 + sprout/config/compiler/gcc_xml.hpp | 1 + sprout/config/compiler/has_future.hpp | 4 + sprout/config/compiler/metrowerks.hpp | 1 + sprout/config/compiler/mpw.hpp | 1 + sprout/config/compiler/no_future.hpp | 4 + sprout/config/compiler/pathscale.hpp | 1 + sprout/config/compiler/pgi.hpp | 1 + sprout/config/compiler/sunpro_cc.hpp | 1 + sprout/config/compiler/vacpp.hpp | 1 + sprout/config/compiler/visualc.hpp | 1 + sprout/config/suffix.hpp | 9 ++ sprout/type_traits/std.hpp | 1 + sprout/type_traits/std_value_variables.hpp | 164 +++++++++++++++++++++ 20 files changed, 206 insertions(+) create mode 100644 sprout/type_traits/std_value_variables.hpp diff --git a/sprout/config/auto_config.hpp b/sprout/config/auto_config.hpp index 6bc8b47f..73ea597a 100644 --- a/sprout/config/auto_config.hpp +++ b/sprout/config/auto_config.hpp @@ -101,6 +101,15 @@ # endif // #ifdef SPROUT_NO_CXX11_UNICODE_LITERALS #endif // #ifndef SPROUT_CONFIG_DISABLE_UNICODE_LITERALS +// +// SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES +// +#ifndef SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES +# ifdef SPROUT_NO_CXX14_VARIABLE_TEMPLATES +# define SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES +# endif // #ifdef SPROUT_NO_CXX14_VARIABLE_TEMPLATES +#endif // #ifndef SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES + // // SPROUT_CONFIG_USE_SSCRISK_CEL // diff --git a/sprout/config/compiler/borland.hpp b/sprout/config/compiler/borland.hpp index 5e291d69..eef7673d 100644 --- a/sprout/config/compiler/borland.hpp +++ b/sprout/config/compiler/borland.hpp @@ -21,5 +21,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_BORLAND_HPP diff --git a/sprout/config/compiler/clang.hpp b/sprout/config/compiler/clang.hpp index b5d0fc0b..cae16281 100644 --- a/sprout/config/compiler/clang.hpp +++ b/sprout/config/compiler/clang.hpp @@ -48,6 +48,8 @@ # define SPROUT_NO_CXX14_CONSTEXPR #endif +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES + #if !defined(SPROUT_NO_CXX11_CONSTEXPR) # define SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE #endif diff --git a/sprout/config/compiler/codegear.hpp b/sprout/config/compiler/codegear.hpp index b939a339..c601cbc5 100644 --- a/sprout/config/compiler/codegear.hpp +++ b/sprout/config/compiler/codegear.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_CODEGEAR_HPP diff --git a/sprout/config/compiler/common_edg.hpp b/sprout/config/compiler/common_edg.hpp index 45f810c7..c7d7ec55 100644 --- a/sprout/config/compiler/common_edg.hpp +++ b/sprout/config/compiler/common_edg.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_COMMON_EDG_HPP diff --git a/sprout/config/compiler/digitalmars.hpp b/sprout/config/compiler/digitalmars.hpp index 57cdcd6e..200f5c7b 100644 --- a/sprout/config/compiler/digitalmars.hpp +++ b/sprout/config/compiler/digitalmars.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_DIGITALMARS_HPP diff --git a/sprout/config/compiler/gcc.hpp b/sprout/config/compiler/gcc.hpp index 3c744e55..597c94e3 100644 --- a/sprout/config/compiler/gcc.hpp +++ b/sprout/config/compiler/gcc.hpp @@ -53,5 +53,6 @@ #endif #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_GCC_HPP diff --git a/sprout/config/compiler/gcc_xml.hpp b/sprout/config/compiler/gcc_xml.hpp index f7674a96..106c2c33 100644 --- a/sprout/config/compiler/gcc_xml.hpp +++ b/sprout/config/compiler/gcc_xml.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_GCC_XML_HPP diff --git a/sprout/config/compiler/has_future.hpp b/sprout/config/compiler/has_future.hpp index 6ae5d554..195205c5 100644 --- a/sprout/config/compiler/has_future.hpp +++ b/sprout/config/compiler/has_future.hpp @@ -36,4 +36,8 @@ # define SPROUT_HAS_UNICODE_LITERALS #endif +#ifndef SPROUT_NO_CXX14_VARIABLE_TEMPLATES +# define SPROUT_HAS_VARIABLE_TEMPLATES +#endif + #endif // #ifndef SPROUT_CONFIG_COMPILER_HAS_FUTURE_HPP diff --git a/sprout/config/compiler/metrowerks.hpp b/sprout/config/compiler/metrowerks.hpp index ea4bb16f..968f4b29 100644 --- a/sprout/config/compiler/metrowerks.hpp +++ b/sprout/config/compiler/metrowerks.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_METROWERKS_HPP diff --git a/sprout/config/compiler/mpw.hpp b/sprout/config/compiler/mpw.hpp index 7e3f5b6a..ad0a7736 100644 --- a/sprout/config/compiler/mpw.hpp +++ b/sprout/config/compiler/mpw.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_MPW_HPP diff --git a/sprout/config/compiler/no_future.hpp b/sprout/config/compiler/no_future.hpp index e17167b1..1f415e23 100644 --- a/sprout/config/compiler/no_future.hpp +++ b/sprout/config/compiler/no_future.hpp @@ -36,4 +36,8 @@ # define SPROUT_NO_UNICODE_LITERALS #endif +#ifdef SPROUT_NO_CXX14_VARIABLE_TEMPLATES +# define SPROUT_NO_VARIABLE_TEMPLATES +#endif + #endif // #ifndef SPROUT_CONFIG_COMPILER_NO_FUTURE_HPP diff --git a/sprout/config/compiler/pathscale.hpp b/sprout/config/compiler/pathscale.hpp index 6051be64..c249e508 100644 --- a/sprout/config/compiler/pathscale.hpp +++ b/sprout/config/compiler/pathscale.hpp @@ -20,6 +20,7 @@ # define SPROUT_NO_CXX11_UNICODE_LITERALS # define SPROUT_NO_CXX14_CONSTEXPR +# define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif #endif // #ifndef SPROUT_CONFIG_COMPILER_PATHSCALE_HPP diff --git a/sprout/config/compiler/pgi.hpp b/sprout/config/compiler/pgi.hpp index 7053a1c9..1499ebf2 100644 --- a/sprout/config/compiler/pgi.hpp +++ b/sprout/config/compiler/pgi.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_PGI_HPP diff --git a/sprout/config/compiler/sunpro_cc.hpp b/sprout/config/compiler/sunpro_cc.hpp index bee3cde0..f6d6b0a4 100644 --- a/sprout/config/compiler/sunpro_cc.hpp +++ b/sprout/config/compiler/sunpro_cc.hpp @@ -19,5 +19,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_SUNPRO_CC_HPP diff --git a/sprout/config/compiler/vacpp.hpp b/sprout/config/compiler/vacpp.hpp index 69d2b00a..3bffbdcc 100644 --- a/sprout/config/compiler/vacpp.hpp +++ b/sprout/config/compiler/vacpp.hpp @@ -23,5 +23,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_VACPP_HPP diff --git a/sprout/config/compiler/visualc.hpp b/sprout/config/compiler/visualc.hpp index 22e43159..7b99b1c4 100644 --- a/sprout/config/compiler/visualc.hpp +++ b/sprout/config/compiler/visualc.hpp @@ -21,5 +21,6 @@ #define SPROUT_NO_CXX11_UNICODE_LITERALS #define SPROUT_NO_CXX14_CONSTEXPR +#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES #endif // #ifndef SPROUT_CONFIG_COMPILER_VISUALC_HPP diff --git a/sprout/config/suffix.hpp b/sprout/config/suffix.hpp index c2b78487..909979d9 100644 --- a/sprout/config/suffix.hpp +++ b/sprout/config/suffix.hpp @@ -138,6 +138,15 @@ # define SPROUT_USE_UNICODE_LITERALS 0 #endif // #ifndef SPROUT_CONFIG_DISABLE_UNICODE_LITERALS +// +// SPROUT_USE_VARIABLE_TEMPLATES +// +#ifndef SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES +# define SPROUT_USE_VARIABLE_TEMPLATES 1 +#else // #ifndef SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES +# define SPROUT_USE_VARIABLE_TEMPLATES 0 +#endif // #ifndef SPROUT_CONFIG_DISABLE_VARIABLE_TEMPLATES + // // SPROUT_USE_BUILTIN_CMATH_FUNCTION // diff --git a/sprout/type_traits/std.hpp b/sprout/type_traits/std.hpp index d52e17a0..197fc999 100644 --- a/sprout/type_traits/std.hpp +++ b/sprout/type_traits/std.hpp @@ -12,5 +12,6 @@ #include #include #include +#include #endif // #ifndef SPROUT_TYPE_TRAITS_STD_HPP diff --git a/sprout/type_traits/std_value_variables.hpp b/sprout/type_traits/std_value_variables.hpp new file mode 100644 index 00000000..b198d0a2 --- /dev/null +++ b/sprout/type_traits/std_value_variables.hpp @@ -0,0 +1,164 @@ +/*============================================================================= + Copyright (c) 2011-2013 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_STD_VALUE_VARIABLES_HPP +#define SPROUT_TYPE_TRAITS_STD_VALUE_VARIABLES_HPP + +#include +#if SPROUT_USE_VARIABLE_TEMPLATES +# include +# include +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES + +namespace sprout { +#if SPROUT_USE_VARIABLE_TEMPLATES + // 20.10.4.1 Primary type categories + + template + SPROUT_STATIC_CONSTEXPR bool is_void_v = sprout::is_void::value; + template + SPROUT_STATIC_CONSTEXPR bool is_null_pointer_v = sprout::is_null_pointer::value; + template + SPROUT_STATIC_CONSTEXPR bool is_integral_v = sprout::is_integral::value; + template + SPROUT_STATIC_CONSTEXPR bool is_floating_point_v = sprout::is_floating_point::value; + template + SPROUT_STATIC_CONSTEXPR bool is_array_v = sprout::is_array::value; + template + SPROUT_STATIC_CONSTEXPR bool is_pointer_v = sprout::is_pointer::value; + template + SPROUT_STATIC_CONSTEXPR bool is_lvalue_reference_v = sprout::is_lvalue_reference::value; + template + SPROUT_STATIC_CONSTEXPR bool is_rvalue_reference_v = sprout::is_rvalue_reference::value; + template + SPROUT_STATIC_CONSTEXPR bool is_member_object_pointer_v = sprout::is_member_object_pointer::value; + template + SPROUT_STATIC_CONSTEXPR bool is_member_function_pointer_v = sprout::is_member_function_pointer::value; + template + SPROUT_STATIC_CONSTEXPR bool is_enum_v = sprout::is_enum::value; + template + SPROUT_STATIC_CONSTEXPR bool is_union_v = sprout::is_union::value; + template + SPROUT_STATIC_CONSTEXPR bool is_class_v = sprout::is_class::value; + template + SPROUT_STATIC_CONSTEXPR bool is_function_v = sprout::is_function::value; + + // 20.10.4.2 Composite type traits + + template + SPROUT_STATIC_CONSTEXPR bool is_reference_v = sprout::is_reference::value; + template + SPROUT_STATIC_CONSTEXPR bool is_arithmetic_v = sprout::is_arithmetic::value; + template + SPROUT_STATIC_CONSTEXPR bool is_fundamental_v = sprout::is_fundamental::value; + template + SPROUT_STATIC_CONSTEXPR bool is_object_v = sprout::is_object::value; + template + SPROUT_STATIC_CONSTEXPR bool is_scalar_v = sprout::is_scalar::value; + template + SPROUT_STATIC_CONSTEXPR bool is_compound_v = sprout::is_compound::value; + template + SPROUT_STATIC_CONSTEXPR bool is_member_pointer_v = sprout::is_member_pointer::value; + + // 20.10.4.3 Type properties + + template + SPROUT_STATIC_CONSTEXPR bool is_const_v = sprout::is_const::value; + template + SPROUT_STATIC_CONSTEXPR bool is_volatile_v = sprout::is_volatile::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivial_v = sprout::is_trivial::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_copyable_v = sprout::is_trivially_copyable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_standard_layout_v = sprout::is_standard_layout::value; + template + SPROUT_STATIC_CONSTEXPR bool is_pod_v = sprout::is_pod::value; + template + SPROUT_STATIC_CONSTEXPR bool is_literal_type_v = sprout::is_literal_type::value; + template + SPROUT_STATIC_CONSTEXPR bool is_empty_v = sprout::is_empty::value; + template + SPROUT_STATIC_CONSTEXPR bool is_polymorphic_v = sprout::is_polymorphic::value; + template + SPROUT_STATIC_CONSTEXPR bool is_abstract_v = sprout::is_abstract::value; + template + SPROUT_STATIC_CONSTEXPR bool is_signed_v = sprout::is_signed::value; + template + SPROUT_STATIC_CONSTEXPR bool is_unsigned_v = sprout::is_unsigned::value; + template + SPROUT_STATIC_CONSTEXPR bool is_constructible_v = sprout::is_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_default_constructible_v = sprout::is_default_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_copy_constructible_v = sprout::is_copy_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_move_constructible_v = sprout::is_move_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_assignable_v = sprout::is_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_copy_assignable_v = sprout::is_copy_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_move_assignable_v = sprout::is_move_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_destructible_v = sprout::is_destructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_constructible_v = sprout::is_trivially_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_default_constructible_v = sprout::is_trivially_default_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_copy_constructible_v = sprout::is_trivially_copy_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_move_constructible_v = sprout::is_trivially_move_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_assignable_v = sprout::is_trivially_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_copy_assignable_v = sprout::is_trivially_copy_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_move_assignable_v = sprout::is_trivially_move_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_trivially_destructible_v = sprout::is_trivially_destructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_constructible_v = sprout::is_nothrow_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_default_constructible_v = sprout::is_nothrow_default_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_copy_constructible_v = sprout::is_nothrow_copy_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_move_constructible_v = sprout::is_nothrow_move_constructible::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_assignable_v = sprout::is_nothrow_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_copy_assignable_v = sprout::is_nothrow_copy_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_move_assignable_v = sprout::is_nothrow_move_assignable::value; + template + SPROUT_STATIC_CONSTEXPR bool is_nothrow_destructible_v = sprout::is_nothrow_destructible::value; + template + SPROUT_STATIC_CONSTEXPR bool has_virtual_destructor_v = sprout::has_virtual_destructor::value; + + // 20.10.5 Type property queries + + template + SPROUT_STATIC_CONSTEXPR std::size_t alignment_of_v = sprout::alignment_of::value; + template + SPROUT_STATIC_CONSTEXPR std::size_t rank_v = sprout::rank::value; + template + SPROUT_STATIC_CONSTEXPR std::size_t extent_v = sprout::extent::value; + + // 20.10.6 Relationships between types + + template + SPROUT_STATIC_CONSTEXPR bool is_same_v = sprout::is_same::value; + template + SPROUT_STATIC_CONSTEXPR bool is_base_of_v = sprout::is_base_of::value; + template + SPROUT_STATIC_CONSTEXPR bool is_convertible_v = sprout::is_convertible>::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_STD_VALUE_VARIABLES_HPP