#ifndef SPROUT_COMPOST_FORMATS_AS_COMPLEX_HPP #define SPROUT_COMPOST_FORMATS_AS_COMPLEX_HPP #include #include #include #include namespace sprout { namespace compost { // // to_complex_value // struct to_complex_value { public: template SPROUT_CONSTEXPR sprout::complex operator()(FloatType const& x) const { return sprout::complex(x); } }; namespace formats { // // as_complex_forwarder // class as_complex_forwarder {}; // // as_complex // namespace { SPROUT_STATIC_CONSTEXPR sprout::compost::formats::as_complex_forwarder as_complex = {}; } // anonymous-namespace // // operator| // template inline SPROUT_CONSTEXPR auto operator|(Range&& lhs, sprout::compost::formats::as_complex_forwarder const& rhs) -> decltype( sprout::forward(lhs) | sprout::adaptors::transformed(sprout::compost::to_complex_value()) ) { return sprout::forward(lhs) | sprout::adaptors::transformed(sprout::compost::to_complex_value()) ; } } // namespace formats using sprout::compost::formats::as_complex; } // namespace compost } // namespace sprout #endif // #ifndef SPROUT_COMPOST_FORMATS_AS_COMPLEX_HPP