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

all type_traits support C++14 requirements

This commit is contained in:
bolero-MURAKAMI 2013-11-22 21:11:08 +09:00
parent bf0c7021cf
commit 403e83eaf0
95 changed files with 319 additions and 268 deletions

View file

@ -28,6 +28,7 @@
#include <sprout/functional/mem_fn.hpp>
#include <sprout/functional/type_traits/weak_result_type.hpp>
#include <sprout/functional/bind/placeholder.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
// 20.8.9 bind
@ -37,7 +38,7 @@ namespace sprout {
//
template<typename T>
struct is_bind_expression
: public std::false_type
: public sprout::false_type
{};
template<typename T>
struct is_bind_expression<T const>
@ -201,7 +202,7 @@ namespace sprout {
public:
template<typename T>
struct apply
: public std::integral_constant<
: public sprout::integral_constant<
bool,
(sprout::is_variadic_placeholder<T>::value > 0)
>
@ -209,7 +210,7 @@ namespace sprout {
};
template<typename Bounds, typename = void>
struct is_variadic_bounds
: public std::integral_constant<
: public sprout::integral_constant<
bool,
(sprout::types::find_index_if<Bounds, sprout::detail::is_variadic_placeholder_pred>::value != sprout::tuples::tuple_size<Bounds>::value)
>
@ -217,19 +218,19 @@ namespace sprout {
template<typename T>
struct tail_place
: public std::integral_constant<int, sprout::is_variadic_placeholder<T>::value - 1>
: public sprout::integral_constant<int, sprout::is_variadic_placeholder<T>::value - 1>
{};
template<typename T, std::size_t ArgSize, typename = void>
struct bound_size
: public std::integral_constant<std::size_t, 1>
: public sprout::integral_constant<std::size_t, 1>
{};
template<typename T, std::size_t ArgSize>
struct bound_size<
T, ArgSize,
typename std::enable_if<(sprout::is_variadic_placeholder<T>::value > 0)>::type
>
: public std::integral_constant<
: public sprout::integral_constant<
std::size_t,
(ArgSize - sprout::detail::tail_place<T>::value)
>
@ -237,14 +238,14 @@ namespace sprout {
template<std::size_t I, typename Bounds, std::size_t ArgSize, typename = void>
struct bounds_size_impl
: public std::integral_constant<std::size_t, 0>
: public sprout::integral_constant<std::size_t, 0>
{};
template<std::size_t I, typename Bounds, std::size_t ArgSize>
struct bounds_size_impl<
I, Bounds, ArgSize,
typename std::enable_if<(I < sprout::tuples::tuple_size<Bounds>::value)>::type
>
: public std::integral_constant<
: public sprout::integral_constant<
std::size_t,
(sprout::detail::bound_size<typename sprout::tuples::tuple_element<I, Bounds>::type, ArgSize>::value
+ sprout::detail::bounds_size_impl<I + 1, Bounds, ArgSize>::value
@ -284,11 +285,11 @@ namespace sprout {
template<sprout::index_t I, typename Bounds, std::size_t ArgSize>
struct bound_position
: public std::integral_constant<
: public sprout::integral_constant<
sprout::index_t,
(sprout::types::lower_bound_index<
typename sprout::detail::bounds_partial_size<Bounds, ArgSize>::type,
std::integral_constant<std::size_t, I + 1>
sprout::integral_constant<std::size_t, I + 1>
>::type::value - 1
)
>
@ -296,7 +297,7 @@ namespace sprout {
template<sprout::index_t I, typename Bounds, std::size_t ArgSize>
struct is_variadic_part
: public std::integral_constant<
: public sprout::integral_constant<
bool,
(sprout::is_variadic_placeholder<
typename sprout::tuples::tuple_element<
@ -798,19 +799,19 @@ namespace sprout {
//
template<typename Signature>
struct is_bind_expression<sprout::binder<Signature> >
: public std::true_type
: public sprout::true_type
{};
template<typename Result, typename Signature>
struct is_bind_expression<sprout::res_binder<Result, Signature> >
: public std::true_type
: public sprout::true_type
{};
template<typename Signature>
struct is_bind_expression<sprout::cbinder<Signature> >
: public std::true_type
: public sprout::true_type
{};
template<typename Result, typename Signature>
struct is_bind_expression<sprout::res_cbinder<Result, Signature> >
: public std::true_type
: public sprout::true_type
{};
namespace detail {

View file

@ -8,8 +8,8 @@
#ifndef SPROUT_FUNCTIONAL_BIND_PLACEHOLDER_HPP
#define SPROUT_FUNCTIONAL_BIND_PLACEHOLDER_HPP
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
//
@ -171,7 +171,7 @@ namespace sprout {
//
template<typename T>
struct is_placeholder
: public std::integral_constant<int, 0>
: public sprout::integral_constant<int, 0>
{};
template<typename T>
struct is_placeholder<T const>
@ -187,7 +187,7 @@ namespace sprout {
{};
template<int N>
struct is_placeholder<sprout::placeholder<N> >
: public std::integral_constant<int, N>
: public sprout::integral_constant<int, N>
{};
//
@ -195,7 +195,7 @@ namespace sprout {
//
template<typename T>
struct is_positional_placeholder
: public std::integral_constant<int, 0>
: public sprout::integral_constant<int, 0>
{};
template<typename T>
struct is_positional_placeholder<T const>
@ -211,7 +211,7 @@ namespace sprout {
{};
template<>
struct is_positional_placeholder<sprout::positional_placeholder>
: public std::integral_constant<int, 1>
: public sprout::integral_constant<int, 1>
{};
//
@ -219,7 +219,7 @@ namespace sprout {
//
template<typename T>
struct is_variadic_placeholder
: public std::integral_constant<int, 0>
: public sprout::integral_constant<int, 0>
{};
template<typename T>
struct is_variadic_placeholder<T const>
@ -235,7 +235,7 @@ namespace sprout {
{};
template<int N>
struct is_variadic_placeholder<sprout::variadic_placeholder<N> >
: public std::integral_constant<int, N + 1>
: public sprout::integral_constant<int, N + 1>
{};
} // namespace sprout

View file

@ -15,12 +15,13 @@
#include <sprout/limits.hpp>
#include <sprout/functional/hash/hash_fwd.hpp>
#include <sprout/functional/hash/detail/hash_float.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
namespace hash_detail {
template<typename T>
struct is_basic_number
: public std::integral_constant<
: public sprout::integral_constant<
bool,
std::is_integral<T>::value
&& (sizeof(T) <= sizeof(std::size_t))
@ -28,7 +29,7 @@ namespace sprout {
{};
template<typename T>
struct is_long_number
: public std::integral_constant<
: public sprout::integral_constant<
bool,
std::is_integral<T>::value
&& (sizeof(T) > sizeof(std::size_t))
@ -37,7 +38,7 @@ namespace sprout {
{};
template<typename T>
struct is_ulong_number
: public std::integral_constant<
: public sprout::integral_constant<
bool,
std::is_integral<T>::value
&& (sizeof(T) > sizeof(std::size_t))

View file

@ -12,6 +12,7 @@
#include <functional>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/has_xxx.hpp>
#include <sprout/type_traits/inherit_if_xxx.hpp>
#include <sprout/functional/base.hpp>
@ -211,7 +212,7 @@ namespace sprout {
//
template<typename T>
struct is_reference_wrapper
: public std::false_type
: public sprout::false_type
{};
template<typename T>
struct is_reference_wrapper<T const>
@ -227,7 +228,7 @@ namespace sprout {
{};
template<typename T>
struct is_reference_wrapper<sprout::reference_wrapper<T> >
: public std::true_type
: public sprout::true_type
{};
//

View file

@ -8,9 +8,9 @@
#ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_STRICT_FUNCTION_HPP
#define SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_STRICT_FUNCTION_HPP
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/functional/type_traits/has_type.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
//
@ -18,7 +18,7 @@ namespace sprout {
//
template<typename Fn>
struct is_strict_unary_function
: public std::integral_constant<
: public sprout::integral_constant<
bool,
sprout::has_result_type<Fn>::value
&& sprout::has_argument_type<Fn>::value
@ -29,7 +29,7 @@ namespace sprout {
//
template<typename Fn>
struct is_strict_binary_function
: public std::integral_constant<
: public sprout::integral_constant<
bool,
sprout::has_result_type<Fn>::value
&& sprout::has_first_argument_type<Fn>::value