diff --git a/sprout/functional/bit_and.hpp b/sprout/functional/bit_and.hpp index b5479bb1..e9f5dc5e 100644 --- a/sprout/functional/bit_and.hpp +++ b/sprout/functional/bit_and.hpp @@ -28,6 +28,8 @@ namespace sprout { template<> struct bit_and { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() & std::declval()) diff --git a/sprout/functional/bit_not.hpp b/sprout/functional/bit_not.hpp index 692b059f..0b3fa23c 100644 --- a/sprout/functional/bit_not.hpp +++ b/sprout/functional/bit_not.hpp @@ -27,6 +27,8 @@ namespace sprout { template<> struct bit_not { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(~std::declval()) diff --git a/sprout/functional/bit_or.hpp b/sprout/functional/bit_or.hpp index 29a93042..1040467b 100644 --- a/sprout/functional/bit_or.hpp +++ b/sprout/functional/bit_or.hpp @@ -28,6 +28,8 @@ namespace sprout { template<> struct bit_or { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() | std::declval()) diff --git a/sprout/functional/bit_xor.hpp b/sprout/functional/bit_xor.hpp index e3bff886..05f8a0cb 100644 --- a/sprout/functional/bit_xor.hpp +++ b/sprout/functional/bit_xor.hpp @@ -28,6 +28,8 @@ namespace sprout { template<> struct bit_xor { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() ^ std::declval()) diff --git a/sprout/functional/divides.hpp b/sprout/functional/divides.hpp index e2668141..f8e1410c 100644 --- a/sprout/functional/divides.hpp +++ b/sprout/functional/divides.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct divides { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() / std::declval()) diff --git a/sprout/functional/equal_to.hpp b/sprout/functional/equal_to.hpp index 1533db79..2ebcc82a 100644 --- a/sprout/functional/equal_to.hpp +++ b/sprout/functional/equal_to.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct equal_to { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() == std::declval()) diff --git a/sprout/functional/greater.hpp b/sprout/functional/greater.hpp index 9c64d798..b05d04fe 100644 --- a/sprout/functional/greater.hpp +++ b/sprout/functional/greater.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct greater { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() > std::declval()) diff --git a/sprout/functional/greater_equal.hpp b/sprout/functional/greater_equal.hpp index f6a7af61..984e8617 100644 --- a/sprout/functional/greater_equal.hpp +++ b/sprout/functional/greater_equal.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct greater_equal { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() >= std::declval()) diff --git a/sprout/functional/less.hpp b/sprout/functional/less.hpp index dc4f0d92..367decdb 100644 --- a/sprout/functional/less.hpp +++ b/sprout/functional/less.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct less { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() < std::declval()) diff --git a/sprout/functional/less_equal.hpp b/sprout/functional/less_equal.hpp index fdf78c60..a601e485 100644 --- a/sprout/functional/less_equal.hpp +++ b/sprout/functional/less_equal.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct less_equal { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() <= std::declval()) diff --git a/sprout/functional/logical_and.hpp b/sprout/functional/logical_and.hpp index 95de93d5..6b381e86 100644 --- a/sprout/functional/logical_and.hpp +++ b/sprout/functional/logical_and.hpp @@ -28,6 +28,8 @@ namespace sprout { template<> struct logical_and { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() && std::declval()) diff --git a/sprout/functional/logical_not.hpp b/sprout/functional/logical_not.hpp index 531ab36e..13af5d4e 100644 --- a/sprout/functional/logical_not.hpp +++ b/sprout/functional/logical_not.hpp @@ -27,6 +27,8 @@ namespace sprout { template<> struct logical_not { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(!std::declval()) diff --git a/sprout/functional/logical_or.hpp b/sprout/functional/logical_or.hpp index 4190ab65..929fcec4 100644 --- a/sprout/functional/logical_or.hpp +++ b/sprout/functional/logical_or.hpp @@ -28,6 +28,8 @@ namespace sprout { template<> struct logical_or { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() || std::declval()) diff --git a/sprout/functional/minus.hpp b/sprout/functional/minus.hpp index edcd50db..6a44ba06 100644 --- a/sprout/functional/minus.hpp +++ b/sprout/functional/minus.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct minus { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() - std::declval()) diff --git a/sprout/functional/modulus.hpp b/sprout/functional/modulus.hpp index 4e4ba69d..12de5898 100644 --- a/sprout/functional/modulus.hpp +++ b/sprout/functional/modulus.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct modulus { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() % std::declval()) diff --git a/sprout/functional/multiplies.hpp b/sprout/functional/multiplies.hpp index 585dfcbc..a7b252fe 100644 --- a/sprout/functional/multiplies.hpp +++ b/sprout/functional/multiplies.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct multiplies { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() * std::declval()) diff --git a/sprout/functional/negate.hpp b/sprout/functional/negate.hpp index 7f43001e..259758f7 100644 --- a/sprout/functional/negate.hpp +++ b/sprout/functional/negate.hpp @@ -29,6 +29,8 @@ namespace sprout { template<> struct negate { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(-std::declval()) diff --git a/sprout/functional/not_equal_to.hpp b/sprout/functional/not_equal_to.hpp index 877f5a99..5591f2f6 100644 --- a/sprout/functional/not_equal_to.hpp +++ b/sprout/functional/not_equal_to.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct not_equal_to { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() != std::declval()) diff --git a/sprout/functional/plus.hpp b/sprout/functional/plus.hpp index a67a3f60..abd86018 100644 --- a/sprout/functional/plus.hpp +++ b/sprout/functional/plus.hpp @@ -30,6 +30,8 @@ namespace sprout { template<> struct plus { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(std::declval() + std::declval()) diff --git a/sprout/functional/polymorphic/bit_and.hpp b/sprout/functional/polymorphic/bit_and.hpp index 5f60b1da..d8a677e4 100644 --- a/sprout/functional/polymorphic/bit_and.hpp +++ b/sprout/functional/polymorphic/bit_and.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_AND_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_AND_HPP -#include #include -#include +#include namespace sprout { // // bit_and_t // bit_and_ // - struct bit_and_t { - 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); - } - }; + typedef sprout::bit_and<> bit_and_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::bit_and_t bit_and_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/bit_not.hpp b/sprout/functional/polymorphic/bit_not.hpp index cd0dd9fc..b1effda7 100644 --- a/sprout/functional/polymorphic/bit_not.hpp +++ b/sprout/functional/polymorphic/bit_not.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_NOT_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_NOT_HPP -#include #include -#include +#include namespace sprout { // // bit_not_t // bit_not_ // - struct bit_not_t { - public: - template - SPROUT_CONSTEXPR decltype(~std::declval()) - operator()(T&& x) - const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(~std::declval())) - { - return ~sprout::forward(x); - } - }; + typedef sprout::bit_not<> bit_not_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::bit_not_t bit_not_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/bit_or.hpp b/sprout/functional/polymorphic/bit_or.hpp index 280c3a45..2b619e89 100644 --- a/sprout/functional/polymorphic/bit_or.hpp +++ b/sprout/functional/polymorphic/bit_or.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_OR_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_OR_HPP -#include #include -#include +#include namespace sprout { // // bit_or_t // bit_or_ // - struct bit_or_t { - 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); - } - }; + typedef sprout::bit_or<> bit_or_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::bit_or_t bit_or_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/bit_xor.hpp b/sprout/functional/polymorphic/bit_xor.hpp index 9b342959..d8927010 100644 --- a/sprout/functional/polymorphic/bit_xor.hpp +++ b/sprout/functional/polymorphic/bit_xor.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_XOR_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_XOR_HPP -#include #include -#include +#include namespace sprout { // // bit_xor_t // bit_xor_ // - struct bit_xor_t { - 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); - } - }; + typedef sprout::bit_xor<> bit_xor_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::bit_xor_t bit_xor_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/divides.hpp b/sprout/functional/polymorphic/divides.hpp index 9e21e426..72eb028f 100644 --- a/sprout/functional/polymorphic/divides.hpp +++ b/sprout/functional/polymorphic/divides.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_DEVIDES_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_DEVIDES_HPP -#include #include -#include +#include namespace sprout { // // divides_t // divides_ // - struct divides_t { - 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); - } - }; + typedef sprout::divides<> divides_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::divides_t divides_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/equal_to.hpp b/sprout/functional/polymorphic/equal_to.hpp index 3e182747..e14c36fb 100644 --- a/sprout/functional/polymorphic/equal_to.hpp +++ b/sprout/functional/polymorphic/equal_to.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_EQUAL_TO_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_EQUAL_TO_HPP -#include #include -#include +#include namespace sprout { // // equal_to_t // equal_to_ // - struct equal_to_t { - 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); - } - }; + typedef sprout::equal_to<> equal_to_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::equal_to_t equal_to_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/greater.hpp b/sprout/functional/polymorphic/greater.hpp index 69a01eee..0afd228e 100644 --- a/sprout/functional/polymorphic/greater.hpp +++ b/sprout/functional/polymorphic/greater.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_HPP -#include #include -#include +#include namespace sprout { // // greater_t // greater_ // - struct greater_t { - 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); - } - }; + typedef sprout::greater<> greater_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::greater_t greater_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/greater_equal.hpp b/sprout/functional/polymorphic/greater_equal.hpp index 99aabd0c..290c6163 100644 --- a/sprout/functional/polymorphic/greater_equal.hpp +++ b/sprout/functional/polymorphic/greater_equal.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_EQUAL_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_EQUAL_HPP -#include #include -#include +#include namespace sprout { // // greater_equal_t // greater_equal_ // - struct greater_equal_t { - 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); - } - }; + typedef sprout::greater_equal<> greater_equal_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::greater_equal_t greater_equal_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/less.hpp b/sprout/functional/polymorphic/less.hpp index e63de3a5..8bf2fa2c 100644 --- a/sprout/functional/polymorphic/less.hpp +++ b/sprout/functional/polymorphic/less.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_HPP -#include #include -#include +#include namespace sprout { // // less_t // less_ // - struct less_t { - 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); - } - }; + typedef sprout::less<> less_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::less_t less_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/less_equal.hpp b/sprout/functional/polymorphic/less_equal.hpp index 2f47b359..fce56ea3 100644 --- a/sprout/functional/polymorphic/less_equal.hpp +++ b/sprout/functional/polymorphic/less_equal.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_EQUAL_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_EQUAL_HPP -#include #include -#include +#include namespace sprout { // // less_equal_t // less_equal_ // - struct less_equal_t { - 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); - } - }; + typedef sprout::less_equal<> less_equal_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::less_equal_t less_equal_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/logical_and.hpp b/sprout/functional/polymorphic/logical_and.hpp index 6d16afa9..f7bf1c48 100644 --- a/sprout/functional/polymorphic/logical_and.hpp +++ b/sprout/functional/polymorphic/logical_and.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_AND_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_AND_HPP -#include #include -#include +#include namespace sprout { // // logical_and_t // logical_and_ // - struct logical_and_t { - 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); - } - }; + typedef sprout::logical_and<> logical_and_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::logical_and_t logical_and_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/logical_not.hpp b/sprout/functional/polymorphic/logical_not.hpp index 7f00caab..e8db62f2 100644 --- a/sprout/functional/polymorphic/logical_not.hpp +++ b/sprout/functional/polymorphic/logical_not.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_NOT_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_NOT_HPP -#include #include -#include +#include namespace sprout { // // logical_not_t // logical_not_ // - struct logical_not_t { - public: - template - SPROUT_CONSTEXPR decltype(!std::declval()) - operator()(T&& x) - const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(!std::declval())) - { - return !sprout::forward(x); - } - }; + typedef sprout::logical_not<> logical_not_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::logical_not_t logical_not_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/logical_or.hpp b/sprout/functional/polymorphic/logical_or.hpp index b973a93a..628f2d8a 100644 --- a/sprout/functional/polymorphic/logical_or.hpp +++ b/sprout/functional/polymorphic/logical_or.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_OR_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_OR_HPP -#include #include -#include +#include namespace sprout { // // logical_or_t // logical_or_ // - struct logical_or_t { - 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); - } - }; + typedef sprout::logical_or<> logical_or_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::logical_or_t logical_or_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/minus.hpp b/sprout/functional/polymorphic/minus.hpp index ffa6553c..bda19fc8 100644 --- a/sprout/functional/polymorphic/minus.hpp +++ b/sprout/functional/polymorphic/minus.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MINUS_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_MINUS_HPP -#include #include -#include +#include namespace sprout { // // minus_t // minus_ // - struct minus_t { - 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); - } - }; + typedef sprout::minus<> minus_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::minus_t minus_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/modulus.hpp b/sprout/functional/polymorphic/modulus.hpp index a1ffb02c..1dc39309 100644 --- a/sprout/functional/polymorphic/modulus.hpp +++ b/sprout/functional/polymorphic/modulus.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MODULUS_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_MODULUS_HPP -#include #include -#include +#include namespace sprout { // // modulus_t // modulus_ // - struct modulus_t { - 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); - } - }; + typedef sprout::modulus<> modulus_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::modulus_t modulus_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/multiplies.hpp b/sprout/functional/polymorphic/multiplies.hpp index f3e9706e..e8561e2f 100644 --- a/sprout/functional/polymorphic/multiplies.hpp +++ b/sprout/functional/polymorphic/multiplies.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MULTIPLIES_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_MULTIPLIES_HPP -#include #include -#include +#include namespace sprout { // // multiplies_t // multiplies_ // - struct multiplies_t { - 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); - } - }; + typedef sprout::multiplies<> multiplies_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::multiplies_t multiplies_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/negate.hpp b/sprout/functional/polymorphic/negate.hpp index 038c489e..623486d4 100644 --- a/sprout/functional/polymorphic/negate.hpp +++ b/sprout/functional/polymorphic/negate.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_NEGATE_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_NEGATE_HPP -#include #include -#include +#include namespace sprout { // // negate_t // negate_ // - struct negate_t { - public: - template - SPROUT_CONSTEXPR decltype(-std::declval()) - operator()(T&& x) - const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(-std::declval())) - { - return -sprout::forward(x); - } - }; + typedef sprout::negate<> negate_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::negate_t negate_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/not_equal_to.hpp b/sprout/functional/polymorphic/not_equal_to.hpp index 4fb2de03..03398bb3 100644 --- a/sprout/functional/polymorphic/not_equal_to.hpp +++ b/sprout/functional/polymorphic/not_equal_to.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_NOT_EQUAL_TO_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_NOT_EQUAL_TO_HPP -#include #include -#include +#include namespace sprout { // // not_equal_to_t // not_equal_to_ // - struct not_equal_to_t { - 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); - } - }; + typedef sprout::not_equal_to<> not_equal_to_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::not_equal_to_t not_equal_to_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/plus.hpp b/sprout/functional/polymorphic/plus.hpp index 1e1abf5a..47660faa 100644 --- a/sprout/functional/polymorphic/plus.hpp +++ b/sprout/functional/polymorphic/plus.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PLUS_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_PLUS_HPP -#include #include -#include +#include namespace sprout { // // plus_t // plus_ // - struct plus_t { - 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); - } - }; + typedef sprout::plus<> plus_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::plus_t plus_ = {}; } // anonymous-namespace diff --git a/sprout/functional/polymorphic/posite.hpp b/sprout/functional/polymorphic/posite.hpp index 4d8d67f0..0ad10509 100644 --- a/sprout/functional/polymorphic/posite.hpp +++ b/sprout/functional/polymorphic/posite.hpp @@ -8,25 +8,15 @@ #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POSITE_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_POSITE_HPP -#include #include -#include +#include namespace sprout { // // posite_t // posite_ // - struct posite_t { - public: - template - SPROUT_CONSTEXPR decltype(+std::declval()) - operator()(T&& x) - const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(+std::declval())) - { - return +sprout::forward(x); - } - }; + typedef sprout::posite<> posite_t; namespace { SPROUT_STATIC_CONSTEXPR sprout::posite_t posite_ = {}; } // anonymous-namespace diff --git a/sprout/functional/posite.hpp b/sprout/functional/posite.hpp index 6031f9a1..3565830e 100644 --- a/sprout/functional/posite.hpp +++ b/sprout/functional/posite.hpp @@ -29,6 +29,8 @@ namespace sprout { template<> struct posite { + public: + typedef void is_transparent; public: template SPROUT_CONSTEXPR decltype(+std::declval()) diff --git a/sprout/functional/type_traits.hpp b/sprout/functional/type_traits.hpp index bcf3ea88..e8e8c3c7 100644 --- a/sprout/functional/type_traits.hpp +++ b/sprout/functional/type_traits.hpp @@ -13,5 +13,6 @@ #include #include #include +#include #endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_HPP diff --git a/sprout/functional/type_traits/is_transparent_function.hpp b/sprout/functional/type_traits/is_transparent_function.hpp new file mode 100644 index 00000000..e71d330a --- /dev/null +++ b/sprout/functional/type_traits/is_transparent_function.hpp @@ -0,0 +1,21 @@ +/*============================================================================= + 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_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP +#define SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP + +#include +#include + +namespace sprout { + // + // is_transparent + // + SPROUT_HAS_XXX_TYPE_DEF(is_transparent_function, is_transparent); +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP