1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

add type_traits for variable templates version

This commit is contained in:
bolero-MURAKAMI 2014-03-15 18:11:11 +09:00
parent 7e709630c6
commit 61dd3351fc
26 changed files with 205 additions and 48 deletions

View file

@ -22,6 +22,17 @@ namespace sprout {
SPROUT_HAS_XXX_TYPE_DEF_LAZY(argument_type);
SPROUT_HAS_XXX_TYPE_DEF_LAZY(first_argument_type);
SPROUT_HAS_XXX_TYPE_DEF_LAZY(second_argument_type);
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>
SPROUT_STATIC_CONSTEXPR bool has_result_type_v = sprout::has_result_type<T>::value;
template<typename T>
SPROUT_STATIC_CONSTEXPR bool has_argument_type_v = sprout::has_argument_type<T>::value;
template<typename T>
SPROUT_STATIC_CONSTEXPR bool has_first_argument_type_v = sprout::has_first_argument_type<T>::value;
template<typename T>
SPROUT_STATIC_CONSTEXPR bool has_second_argument_type_v = sprout::has_second_argument_type<T>::value;
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_HAS_TYPE_HPP

View file

@ -15,6 +15,7 @@
namespace sprout {
//
// is_strict_unary_function
// is_strict_binary_function
//
template<typename Fn>
struct is_strict_unary_function
@ -24,9 +25,6 @@ namespace sprout {
&& sprout::has_argument_type<Fn>::value
>
{};
//
// is_strict_binary_function
//
template<typename Fn>
struct is_strict_binary_function
: public sprout::integral_constant<
@ -36,6 +34,13 @@ namespace sprout {
&& sprout::has_second_argument_type<Fn>::value
>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>
SPROUT_STATIC_CONSTEXPR bool is_strict_unary_function_v = sprout::is_strict_unary_function<T>::value;
template<typename T>
SPROUT_STATIC_CONSTEXPR bool is_strict_binary_function_v = sprout::is_strict_binary_function<T>::value;
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_STRICT_FUNCTION_HPP

View file

@ -16,6 +16,11 @@ namespace sprout {
// is_transparent_function
//
SPROUT_HAS_XXX_TYPE_DEF(is_transparent_function, is_transparent);
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>
SPROUT_STATIC_CONSTEXPR bool is_transparent_function_v = sprout::is_transparent_function<T>::value;
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP

View file

@ -87,6 +87,11 @@ namespace sprout {
SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT_BODY
#endif
};
#if SPROUT_USE_TEMPLATE_ALIASES
template<typename T>
using weak_result_type_t = typename sprout::weak_result_type<T>::type;
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_WEAK_RESULT_TYPE_HPP