#ifndef SPROUT_COMPOST_EFFECTS_SYNTHESIZED_HPP #define SPROUT_COMPOST_EFFECTS_SYNTHESIZED_HPP #include #include #include #include #include namespace sprout { namespace compost { namespace effects { // // synthesize_holder // template class synthesize_holder { public: typedef RRange range2_type; private: sprout::value_holder range_; public: synthesize_holder() = default; synthesize_holder(synthesize_holder const&) = default; explicit SPROUT_CONSTEXPR synthesize_holder(range2_type& range) : range_(range) {} SPROUT_CONSTEXPR range2_type& range() const { return range_; } }; // // synthesized_forwarder // class synthesized_forwarder { public: template SPROUT_CONSTEXPR sprout::compost::effects::synthesize_holder< typename std::remove_reference::type>::type > operator()(RRange&& range) { return sprout::compost::effects::synthesize_holder< typename std::remove_reference::type>::type >( sprout::lvalue_forward(range) ); } }; // // synthesized // namespace { SPROUT_STATIC_CONSTEXPR sprout::compost::effects::synthesized_forwarder synthesized{}; } // anonymous-namespace // // operator| // template inline SPROUT_CONSTEXPR auto operator|(Range&& lhs, sprout::compost::effects::synthesize_holder const& rhs) -> decltype( sprout::forward(lhs) | sprout::adaptors::transformed(rhs.range(), sprout::plus<>()) ) { return sprout::forward(lhs) | sprout::adaptors::transformed(rhs.range(), sprout::plus<>()) ; } } // namespace effects } // namespace compost } // namespace sprout #endif // #ifndef SPROUT_COMPOST_EFFECTS_SYNTHESIZED_HPP