mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-02-04 21:33:56 +00:00
add comparison and arithmetic type functionals
This commit is contained in:
parent
062058e614
commit
8418b81099
19 changed files with 311 additions and 75 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <sprout/type/apply.hpp>
|
#include <sprout/type/apply.hpp>
|
||||||
#include <sprout/type/quote.hpp>
|
#include <sprout/type/quote.hpp>
|
||||||
|
#include <sprout/type/self.hpp>
|
||||||
#include <sprout/type/tuple.hpp>
|
#include <sprout/type/tuple.hpp>
|
||||||
#include <sprout/type/type_tuple.hpp>
|
#include <sprout/type/type_tuple.hpp>
|
||||||
#include <sprout/type/integral_array.hpp>
|
#include <sprout/type/integral_array.hpp>
|
||||||
|
|
|
@ -19,15 +19,15 @@ namespace sprout {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<
|
template<
|
||||||
typename Tuple, typename T, typename BinaryOp, std::size_t I,
|
typename Tuple, typename T, typename BinaryOp, std::size_t I,
|
||||||
bool = (I == sprout::types::tuple_size<Tuple>::value)
|
bool Valid = (I != sprout::types::tuple_size<Tuple>::value)
|
||||||
>
|
>
|
||||||
struct fold_impl;
|
struct fold_impl;
|
||||||
template<typename Tuple, typename T, typename BinaryOp, std::size_t I>
|
template<typename Tuple, typename T, typename BinaryOp, std::size_t I>
|
||||||
struct fold_impl<Tuple, T, BinaryOp, I, true>
|
struct fold_impl<Tuple, T, BinaryOp, I, false>
|
||||||
: public sprout::identity<T>
|
: public sprout::identity<T>
|
||||||
{};
|
{};
|
||||||
template<typename Tuple, typename T, typename BinaryOp, std::size_t I>
|
template<typename Tuple, typename T, typename BinaryOp, std::size_t I>
|
||||||
struct fold_impl<Tuple, T, BinaryOp, I, false>
|
struct fold_impl<Tuple, T, BinaryOp, I, true>
|
||||||
: public sprout::types::detail::fold_impl<
|
: public sprout::types::detail::fold_impl<
|
||||||
Tuple,
|
Tuple,
|
||||||
typename sprout::types::apply<BinaryOp, T, typename sprout::types::tuple_element<I, Tuple>::type>::type,
|
typename sprout::types::apply<BinaryOp, T, typename sprout::types::tuple_element<I, Tuple>::type>::type,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define SPROUT_TYPE_FUNCTIONAL_HPP
|
#define SPROUT_TYPE_FUNCTIONAL_HPP
|
||||||
|
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <sprout/type/functional/less.hpp>
|
#include <sprout/type/functional/arithmetic.hpp>
|
||||||
#include <sprout/type/functional/plus.hpp>
|
#include <sprout/type/functional/comparison.hpp>
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_HPP
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_HPP
|
||||||
|
|
18
sprout/type/functional/arithmetic.hpp
Normal file
18
sprout/type/functional/arithmetic.hpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_ARITHMETIC_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_ARITHMETIC_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/plus.hpp>
|
||||||
|
#include <sprout/type/functional/minus.hpp>
|
||||||
|
#include <sprout/type/functional/multiplies.hpp>
|
||||||
|
#include <sprout/type/functional/divides.hpp>
|
||||||
|
#include <sprout/type/functional/modulus.hpp>
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_ARITHMETIC_HPP
|
18
sprout/type/functional/comparison.hpp
Normal file
18
sprout/type/functional/comparison.hpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_COMPARISON_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_COMPARISON_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/equal_to.hpp>
|
||||||
|
#include <sprout/type/functional/not_equal_to.hpp>
|
||||||
|
#include <sprout/type/functional/less_equal.hpp>
|
||||||
|
#include <sprout/type/functional/greater.hpp>
|
||||||
|
#include <sprout/type/functional/greater_equal.hpp>
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_COMPARISON_HPP
|
50
sprout/type/functional/detail/arithmetic_op.hpp
Normal file
50
sprout/type/functional/detail/arithmetic_op.hpp
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_DETAIL_ARITHMETIC_OP_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_DETAIL_ARITHMETIC_OP_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||||
|
#include <sprout/preprocessor/cat.hpp>
|
||||||
|
|
||||||
|
#define SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_DECL(NAME, OP) \
|
||||||
|
namespace sprout { \
|
||||||
|
namespace types { \
|
||||||
|
template<typename T, typename U, typename Result = void> \
|
||||||
|
struct NAME \
|
||||||
|
: public sprout::integral_constant<Result, (T::value OP U::value)> \
|
||||||
|
{}; \
|
||||||
|
template<typename T, typename U> \
|
||||||
|
struct NAME<T, U, void> \
|
||||||
|
: public sprout::integral_constant< \
|
||||||
|
typename sprout::arithmetic_promote<typename T::value_type, typename U::value_type>::type, \
|
||||||
|
(T::value OP U::value) \
|
||||||
|
> \
|
||||||
|
{}; \
|
||||||
|
template<typename Result = void> \
|
||||||
|
struct SPROUT_PP_CAT(NAME, _mf) { \
|
||||||
|
public: \
|
||||||
|
template<typename T, typename U> \
|
||||||
|
struct apply \
|
||||||
|
: public sprout::types::NAME<T, U, Result> \
|
||||||
|
{}; \
|
||||||
|
}; \
|
||||||
|
typedef sprout::types::SPROUT_PP_CAT(NAME, _mf)<> SPROUT_PP_CAT(NAME, _); \
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_VT_DECL(NAME) \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
|
# define SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_VT_DECL(NAME) \
|
||||||
|
template<typename T, typename U, typename Result = void> \
|
||||||
|
SPROUT_STATIC_CONSTEXPR typename sprout::types::NAME<T, U, Result>::value_type SPROUT_PP_CAT(NAME, _v) = sprout::types::NAME<T, U, Result>::value;
|
||||||
|
#else // #if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
|
# define SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_VT_DECL(NAME)
|
||||||
|
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_DETAIL_ARITHMETIC_OP_HPP
|
36
sprout/type/functional/detail/comparison_op.hpp
Normal file
36
sprout/type/functional/detail/comparison_op.hpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_DETAIL_COMPARISON_OP_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_DETAIL_COMPARISON_OP_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/integral_constant.hpp>
|
||||||
|
#include <sprout/type/quote.hpp>
|
||||||
|
#include <sprout/preprocessor/cat.hpp>
|
||||||
|
|
||||||
|
#define SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(NAME, OP) \
|
||||||
|
namespace sprout { \
|
||||||
|
namespace types { \
|
||||||
|
template<typename T, typename U> \
|
||||||
|
struct NAME \
|
||||||
|
: public sprout::integral_constant<bool, ((T::value) OP (U::value))> \
|
||||||
|
{}; \
|
||||||
|
typedef sprout::types::quote<sprout::types::NAME> SPROUT_PP_CAT(NAME, _); \
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_VT_DECL(NAME) \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
|
# define SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_VT_DECL(NAME) \
|
||||||
|
template<typename T, typename U> \
|
||||||
|
SPROUT_STATIC_CONSTEXPR bool SPROUT_PP_CAT(NAME, _v) = sprout::types::NAME<T, U>::value;
|
||||||
|
#else // #if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
|
# define SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_VT_DECL(NAME)
|
||||||
|
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_DETAIL_COMPARISON_OP_HPP
|
16
sprout/type/functional/divides.hpp
Normal file
16
sprout/type/functional/divides.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_DIVIDES_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_DIVIDES_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/arithmetic_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_DECL(divides, /)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_DIVIDES_HPP
|
16
sprout/type/functional/equal_to.hpp
Normal file
16
sprout/type/functional/equal_to.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_EQUAL_TO_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_EQUAL_TO_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/comparison_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(equal_to, ==)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_EQUAL_TO_HPP
|
16
sprout/type/functional/greater.hpp
Normal file
16
sprout/type/functional/greater.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_GREATER_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_GREATER_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/comparison_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(greater, >)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_GREATER_HPP
|
16
sprout/type/functional/greater_equal.hpp
Normal file
16
sprout/type/functional/greater_equal.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_GREATER_EQUAL_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_GREATER_EQUAL_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/comparison_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(greater_equal, >=)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_GREATER_EQUAL_HPP
|
|
@ -9,34 +9,8 @@
|
||||||
#define SPROUT_TYPE_FUNCTIONAL_LESS_HPP
|
#define SPROUT_TYPE_FUNCTIONAL_LESS_HPP
|
||||||
|
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <sprout/type_traits/integral_constant.hpp>
|
#include <sprout/type/functional/detail/comparison_op.hpp>
|
||||||
|
|
||||||
namespace sprout {
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(less, <)
|
||||||
namespace types {
|
|
||||||
//
|
|
||||||
// less
|
|
||||||
//
|
|
||||||
template<typename T, typename U>
|
|
||||||
struct less
|
|
||||||
: public sprout::integral_constant<bool, ((T::value) < (U::value))>
|
|
||||||
{};
|
|
||||||
|
|
||||||
//
|
|
||||||
// less_
|
|
||||||
//
|
|
||||||
struct less_ {
|
|
||||||
public:
|
|
||||||
template<typename T, typename U>
|
|
||||||
struct apply
|
|
||||||
: public sprout::types::less<T, U>
|
|
||||||
{};
|
|
||||||
};
|
|
||||||
|
|
||||||
#if SPROUT_USE_VARIABLE_TEMPLATES
|
|
||||||
template<typename T, typename U>
|
|
||||||
SPROUT_STATIC_CONSTEXPR bool less_v = sprout::types::less<T, U>::value;
|
|
||||||
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
|
||||||
} // namespace types
|
|
||||||
} // namespace sprout
|
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_LESS_HPP
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_LESS_HPP
|
||||||
|
|
16
sprout/type/functional/less_equal.hpp
Normal file
16
sprout/type/functional/less_equal.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_LESS_EQUAL_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_LESS_EQUAL_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/comparison_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(less_equal, <=)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_LESS_EQUAL_HPP
|
16
sprout/type/functional/minus.hpp
Normal file
16
sprout/type/functional/minus.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_MINUS_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_MINUS_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/arithmetic_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_DECL(minus, -)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_MINUS_HPP
|
16
sprout/type/functional/modulus.hpp
Normal file
16
sprout/type/functional/modulus.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_MODULUS_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_MODULUS_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/arithmetic_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_DECL(modulus, %)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_MODULUS_HPP
|
16
sprout/type/functional/multiplies.hpp
Normal file
16
sprout/type/functional/multiplies.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_MULTIPLIES_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_MULTIPLIES_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/arithmetic_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_DECL(multiplies, *)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_MULTIPLIES_HPP
|
16
sprout/type/functional/not_equal_to.hpp
Normal file
16
sprout/type/functional/not_equal_to.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_FUNCTIONAL_NOT_EQUAL_TO_HPP
|
||||||
|
#define SPROUT_TYPE_FUNCTIONAL_NOT_EQUAL_TO_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type/functional/detail/comparison_op.hpp>
|
||||||
|
|
||||||
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_COMPARISON_OP_DECL(not_equal_to, !=)
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_NOT_EQUAL_TO_HPP
|
|
@ -9,48 +9,8 @@
|
||||||
#define SPROUT_TYPE_FUNCTIONAL_PLUS_HPP
|
#define SPROUT_TYPE_FUNCTIONAL_PLUS_HPP
|
||||||
|
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <sprout/type_traits/integral_constant.hpp>
|
#include <sprout/type/functional/detail/arithmetic_op.hpp>
|
||||||
#include <sprout/type_traits/common_decay.hpp>
|
|
||||||
|
|
||||||
namespace sprout {
|
SPROUT_TYPES_DETAIL_FUNCTIONAL_ARITHMETIC_BINARY_OP_DECL(plus, +)
|
||||||
namespace types {
|
|
||||||
//
|
|
||||||
// plus
|
|
||||||
//
|
|
||||||
template<typename T, typename U, typename Result = void>
|
|
||||||
struct plus
|
|
||||||
: public sprout::integral_constant<Result, (T::value + U::value)>
|
|
||||||
{};
|
|
||||||
template<typename T, typename U>
|
|
||||||
struct plus<T, U, void>
|
|
||||||
: public sprout::integral_constant<
|
|
||||||
typename sprout::common_decay<typename T::value_type, typename U::value_type>::type,
|
|
||||||
(T::value + U::value)
|
|
||||||
>
|
|
||||||
{};
|
|
||||||
|
|
||||||
//
|
|
||||||
// plus_mf
|
|
||||||
//
|
|
||||||
template<typename Result = void>
|
|
||||||
struct plus_mf {
|
|
||||||
public:
|
|
||||||
template<typename T, typename U>
|
|
||||||
struct apply
|
|
||||||
: public sprout::types::plus<T, U, Result>
|
|
||||||
{};
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// plus_
|
|
||||||
//
|
|
||||||
typedef sprout::types::plus_mf<> plus_;
|
|
||||||
|
|
||||||
#if SPROUT_USE_VARIABLE_TEMPLATES
|
|
||||||
template<typename T, typename U, typename Result = void>
|
|
||||||
SPROUT_STATIC_CONSTEXPR typename sprout::types::plus<T, U, Result>::value_type plus_v = sprout::types::plus<T, U, Result>::value;
|
|
||||||
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
|
||||||
} // namespace types
|
|
||||||
} // namespace sprout
|
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_PLUS_HPP
|
#endif // #ifndef SPROUT_TYPE_FUNCTIONAL_PLUS_HPP
|
||||||
|
|
35
sprout/type/self.hpp
Normal file
35
sprout/type/self.hpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2011-2014 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_SELF_HPP
|
||||||
|
#define SPROUT_TYPE_SELF_HPP
|
||||||
|
|
||||||
|
#include <sprout/config.hpp>
|
||||||
|
#include <sprout/type_traits/identity.hpp>
|
||||||
|
|
||||||
|
namespace sprout {
|
||||||
|
namespace types {
|
||||||
|
//
|
||||||
|
// self
|
||||||
|
//
|
||||||
|
template<template<typename...> class F>
|
||||||
|
struct self {
|
||||||
|
public:
|
||||||
|
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||||
|
template<typename... Types>
|
||||||
|
using apply = sprout::identity<F<Types...> >;
|
||||||
|
#else // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||||
|
template<typename... Types>
|
||||||
|
struct apply
|
||||||
|
: public sprout::identity<F<Types...> >
|
||||||
|
{};
|
||||||
|
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||||
|
};
|
||||||
|
} // namespace types
|
||||||
|
} // namespace sprout
|
||||||
|
|
||||||
|
#endif // #ifndef SPROUT_TYPE_SELF_HPP
|
Loading…
Add table
Reference in a new issue