#ifndef SPROUT_COMPOST_FORMATS_AS_IMAG_HPP #define SPROUT_COMPOST_FORMATS_AS_IMAG_HPP #include #include #include #include #include namespace sprout { namespace compost { // // to_imag_value // struct to_imag_value { public: template SPROUT_CONSTEXPR decltype(imag(std::declval())) operator()(Complex const& x) const { return imag(x); } }; namespace formats { // // as_imag_forwarder // class as_imag_forwarder {}; // // as_imag // namespace { SPROUT_STATIC_CONSTEXPR sprout::compost::formats::as_imag_forwarder as_imag = {}; } // anonymous-namespace // // operator| // template inline SPROUT_CONSTEXPR auto operator|(Range&& lhs, sprout::compost::formats::as_imag_forwarder const&) -> decltype( sprout::forward(lhs) | sprout::adaptors::transformed(sprout::compost::to_imag_value()) ) { return sprout::forward(lhs) | sprout::adaptors::transformed(sprout::compost::to_imag_value()) ; } } // namespace formats using sprout::compost::formats::as_imag; } // namespace compost } // namespace sprout #endif // #ifndef SPROUT_COMPOST_FORMATS_AS_IMAG_HPP