diff --git a/sprout/functional/bit_and.hpp b/sprout/functional/bit_and.hpp index 195a8e6c..26ce0629 100644 --- a/sprout/functional/bit_and.hpp +++ b/sprout/functional/bit_and.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_BIT_AND_HPP #define SPROUT_FUNCTIONAL_BIT_AND_HPP +#include #include +#include namespace sprout { // 20.8.7 bitwise operations - template + template struct bit_and { public: typedef T first_argument_type; @@ -16,6 +18,18 @@ namespace sprout { return x & y; } }; + + template<> + struct bit_and { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() & std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() & std::declval())) + { + return sprout::forward(x) & sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_BIT_AND_HPP diff --git a/sprout/functional/bit_not.hpp b/sprout/functional/bit_not.hpp index 5aee9c9f..c41b3463 100644 --- a/sprout/functional/bit_not.hpp +++ b/sprout/functional/bit_not.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_BIT_NOT_HPP #define SPROUT_FUNCTIONAL_BIT_NOT_HPP +#include #include +#include namespace sprout { // 20.8.7 bitwise operations - template + template struct bit_not { public: typedef T argument_type; @@ -15,6 +17,18 @@ namespace sprout { return ~x; } }; + + template<> + struct bit_not { + public: + template + SPROUT_CONSTEXPR decltype(~std::declval()) + operator()(T&& x) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(~std::declval())) + { + return ~sprout::forward(x); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_BIT_NOT_HPP diff --git a/sprout/functional/bit_or.hpp b/sprout/functional/bit_or.hpp index e9cf3161..edca9b3c 100644 --- a/sprout/functional/bit_or.hpp +++ b/sprout/functional/bit_or.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_BIT_OR_HPP #define SPROUT_FUNCTIONAL_BIT_OR_HPP +#include #include +#include namespace sprout { // 20.8.7 bitwise operations - template + template struct bit_or { public: typedef T first_argument_type; @@ -16,6 +18,18 @@ namespace sprout { return x | y; } }; + + template<> + struct bit_or { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() | std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() | std::declval())) + { + return sprout::forward(x) | sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_BIT_OR_HPP diff --git a/sprout/functional/bit_xor.hpp b/sprout/functional/bit_xor.hpp index 27a289af..cc48f5f8 100644 --- a/sprout/functional/bit_xor.hpp +++ b/sprout/functional/bit_xor.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_BIT_XOR_HPP #define SPROUT_FUNCTIONAL_BIT_XOR_HPP +#include #include +#include namespace sprout { // 20.8.7 bitwise operations - template + template struct bit_xor { public: typedef T first_argument_type; @@ -16,6 +18,18 @@ namespace sprout { return x ^ y; } }; + + template<> + struct bit_xor { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() ^ std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() ^ std::declval())) + { + return sprout::forward(x) ^ sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_BIT_XOR_HPP diff --git a/sprout/functional/divides.hpp b/sprout/functional/divides.hpp index 9a72a4d7..aeecd85f 100644 --- a/sprout/functional/divides.hpp +++ b/sprout/functional/divides.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_DEVIDES_HPP #define SPROUT_FUNCTIONAL_DEVIDES_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct divides { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x / y; } }; + + template<> + struct divides { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() / std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() / std::declval())) + { + return sprout::forward(x) / sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_DEVIDES_HPP diff --git a/sprout/functional/equal_to.hpp b/sprout/functional/equal_to.hpp index 7a32974e..38d18e6a 100644 --- a/sprout/functional/equal_to.hpp +++ b/sprout/functional/equal_to.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_EQUAL_TO_HPP #define SPROUT_FUNCTIONAL_EQUAL_TO_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.5 Comparisons - template + template struct equal_to { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x == y; } }; + + template<> + struct equal_to { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() == std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() == std::declval())) + { + return sprout::forward(x) == sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_EQUAL_TO_HPP diff --git a/sprout/functional/greater.hpp b/sprout/functional/greater.hpp index 5afe7294..b1e95bbc 100644 --- a/sprout/functional/greater.hpp +++ b/sprout/functional/greater.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_GREATER_HPP #define SPROUT_FUNCTIONAL_GREATER_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.5 Comparisons - template + template struct greater { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x > y; } }; + + template<> + struct greater { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() > std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() > std::declval())) + { + return sprout::forward(x) > sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_GREATER_HPP diff --git a/sprout/functional/greater_equal.hpp b/sprout/functional/greater_equal.hpp index 7e4b8cbe..d5edd0a4 100644 --- a/sprout/functional/greater_equal.hpp +++ b/sprout/functional/greater_equal.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_GREATER_EQUAL_HPP #define SPROUT_FUNCTIONAL_GREATER_EQUAL_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.5 Comparisons - template + template struct greater_equal { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x >= y; } }; + + template<> + struct greater_equal { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() >= std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() >= std::declval())) + { + return sprout::forward(x) >= sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_GREATER_EQUAL_HPP diff --git a/sprout/functional/less.hpp b/sprout/functional/less.hpp index aa45d7d3..befb3dca 100644 --- a/sprout/functional/less.hpp +++ b/sprout/functional/less.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_LESS_HPP #define SPROUT_FUNCTIONAL_LESS_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.5 Comparisons - template + template struct less { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x < y; } }; + + template<> + struct less { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() < std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() < std::declval())) + { + return sprout::forward(x) < sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_LESS_HPP diff --git a/sprout/functional/less_equal.hpp b/sprout/functional/less_equal.hpp index a29cb9de..91645fd4 100644 --- a/sprout/functional/less_equal.hpp +++ b/sprout/functional/less_equal.hpp @@ -1,7 +1,9 @@ #ifndef SPROUT_FUNCTIONAL_LESS_EQUAL_HPP #define SPROUT_FUNCTIONAL_LESS_EQUAL_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) @@ -18,6 +20,18 @@ namespace sprout { return x <= y; } }; + + template<> + struct less_equal { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() <= std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() <= std::declval())) + { + return sprout::forward(x) <= sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_LESS_EQUAL_HPP diff --git a/sprout/functional/logical_and.hpp b/sprout/functional/logical_and.hpp index 021c0682..2e301df2 100644 --- a/sprout/functional/logical_and.hpp +++ b/sprout/functional/logical_and.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_LOGICAL_AND_HPP #define SPROUT_FUNCTIONAL_LOGICAL_AND_HPP +#include #include +#include namespace sprout { // 20.8.6 logical operations - template + template struct logical_and { public: typedef T first_argument_type; @@ -16,6 +18,18 @@ namespace sprout { return x && y; } }; + + template<> + struct logical_and { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() && std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() && std::declval())) + { + return sprout::forward(x) && sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_LOGICAL_AND_HPP diff --git a/sprout/functional/logical_not.hpp b/sprout/functional/logical_not.hpp index 5e717a02..e477e860 100644 --- a/sprout/functional/logical_not.hpp +++ b/sprout/functional/logical_not.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_LOGICAL_NOT_HPP #define SPROUT_FUNCTIONAL_LOGICAL_NOT_HPP +#include #include +#include namespace sprout { // 20.8.6 logical operations - template + template struct logical_not { public: typedef T argument_type; @@ -15,6 +17,18 @@ namespace sprout { return !x; } }; + + template<> + struct logical_not { + public: + template + SPROUT_CONSTEXPR decltype(!std::declval()) + operator()(T&& x) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(!std::declval())) + { + return !sprout::forward(x); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_LOGICAL_NOT_HPP diff --git a/sprout/functional/logical_or.hpp b/sprout/functional/logical_or.hpp index f0e0045c..1bdf20b8 100644 --- a/sprout/functional/logical_or.hpp +++ b/sprout/functional/logical_or.hpp @@ -1,11 +1,13 @@ #ifndef SPROUT_FUNCTIONAL_LOGICAL_OR_HPP #define SPROUT_FUNCTIONAL_LOGICAL_OR_HPP +#include #include +#include namespace sprout { // 20.8.6 logical operations - template + template struct logical_or { public: typedef T first_argument_type; @@ -16,6 +18,18 @@ namespace sprout { return x || y; } }; + + template<> + struct logical_or { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() || std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() || std::declval())) + { + return sprout::forward(x) || sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_LOGICAL_OR_HPP diff --git a/sprout/functional/minus.hpp b/sprout/functional/minus.hpp index 8c219d60..e37bc042 100644 --- a/sprout/functional/minus.hpp +++ b/sprout/functional/minus.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_MINUS_HPP #define SPROUT_FUNCTIONAL_MINUS_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct minus { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x - y; } }; + + template<> + struct minus { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() - std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() - std::declval())) + { + return sprout::forward(x) - sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_MINUS_HPP diff --git a/sprout/functional/modulus.hpp b/sprout/functional/modulus.hpp index 5a6decb5..3e0c2d39 100644 --- a/sprout/functional/modulus.hpp +++ b/sprout/functional/modulus.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_MODULUS_HPP #define SPROUT_FUNCTIONAL_X_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct modulus { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x % y; } }; + + template<> + struct modulus { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() % std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() % std::declval())) + { + return sprout::forward(x) % sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_MODULUS_HPP diff --git a/sprout/functional/multiplies.hpp b/sprout/functional/multiplies.hpp index d91988cd..257b124f 100644 --- a/sprout/functional/multiplies.hpp +++ b/sprout/functional/multiplies.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_MULTIPLIES_HPP #define SPROUT_FUNCTIONAL_MULTIPLIES_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct multiplies { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x * y; } }; + + template<> + struct multiplies { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() * std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() * std::declval())) + { + return sprout::forward(x) * sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_MULTIPLIES_HPP diff --git a/sprout/functional/negate.hpp b/sprout/functional/negate.hpp index c0d59868..7ff5c2ff 100644 --- a/sprout/functional/negate.hpp +++ b/sprout/functional/negate.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_NEGATE_HPP #define SPROUT_FUNCTIONAL_NEGATE_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct negate { public: typedef T argument_type; @@ -17,6 +19,18 @@ namespace sprout { return -x; } }; + + template<> + struct negate { + public: + template + SPROUT_CONSTEXPR decltype(-std::declval()) + operator()(T&& x) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(-std::declval())) + { + return -sprout::forward(x); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_NEGATE_HPP diff --git a/sprout/functional/not_equal_to.hpp b/sprout/functional/not_equal_to.hpp index bfb4ec6d..7634b668 100644 --- a/sprout/functional/not_equal_to.hpp +++ b/sprout/functional/not_equal_to.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_NOT_EQUAL_TO_HPP #define SPROUT_FUNCTIONAL_NOT_EQUAL_TO_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.5 Comparisons - template + template struct not_equal_to { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x != y; } }; + + template<> + struct not_equal_to { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() != std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() != std::declval())) + { + return sprout::forward(x) != sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_NOT_EQUAL_TO_HPP diff --git a/sprout/functional/plus.hpp b/sprout/functional/plus.hpp index e511d892..70e81374 100644 --- a/sprout/functional/plus.hpp +++ b/sprout/functional/plus.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_PLUS_HPP #define SPROUT_FUNCTIONAL_PLUS_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct plus { public: typedef T first_argument_type; @@ -18,6 +20,18 @@ namespace sprout { return x + y; } }; + + template<> + struct plus { + public: + template + SPROUT_CONSTEXPR decltype(std::declval() + std::declval()) + operator()(T&& x, U&& y) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval() + std::declval())) + { + return sprout::forward(x) + sprout::forward(y); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_PLUS_HPP diff --git a/sprout/functional/polymorphic/functor.hpp b/sprout/functional/polymorphic/functor.hpp index 17871cb4..20991784 100644 --- a/sprout/functional/polymorphic/functor.hpp +++ b/sprout/functional/polymorphic/functor.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/sprout/functional/posite.hpp b/sprout/functional/posite.hpp index 81c92778..c7c10ff8 100644 --- a/sprout/functional/posite.hpp +++ b/sprout/functional/posite.hpp @@ -1,13 +1,15 @@ #ifndef SPROUT_FUNCTIONAL_POSITE_HPP #define SPROUT_FUNCTIONAL_POSITE_HPP +#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) // 20.8.4 Arithmetic operations - template + template struct posite { public: typedef T argument_type; @@ -17,6 +19,18 @@ namespace sprout { return +x; } }; + + template<> + struct posite { + public: + template + SPROUT_CONSTEXPR decltype(+std::declval()) + operator()(T&& x) + const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(+std::declval())) + { + return +sprout::forward(x); + } + }; } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_POSITE_HPP