#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIND2ND_HPP #define SPROUT_FUNCTIONAL_POLYMORPHIC_BIND2ND_HPP #include #include #include #include namespace sprout { // // binder2nd_ // bind2nd_ // template class binder2nd_ { protected: Fn op; T value; public: SPROUT_CONSTEXPR binder2nd_(Fn&& x, T&& y) : op(sprout::forward(x)), value(sprout::forward(y)) {} template SPROUT_CONSTEXPR decltype(op(std::declval(), value)) operator()(Arg&& x) const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(op(std::declval(), value))) { return op(sprout::forward(x), value); } }; template SPROUT_CONSTEXPR sprout::binder2nd_::type, typename std::decay::type> bind2nd_(Fn&& fn, T&& x) { typedef sprout::binder2nd_::type, typename std::decay::type> type; return type(sprout::forward(fn), sprout::forward(x)); } } // namespace sprout #endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIND2ND_HPP