#ifndef SPROUT_VARIANT_IO_HPP #define SPROUT_VARIANT_IO_HPP #include #include #include namespace sprout { namespace detail { template class variant_output_visitor : public sprout::static_visitor<> { public: typedef OStream ostream_type; private: ostream_type& out_; public: explicit variant_output_visitor(ostream_type& out) : out_(out) {} template void operator()(T const& operand) const { out_ << operand; } }; } // namespace detail // // operator<< // template inline std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::variant const& rhs) { sprout::detail::variant_output_visitor > visitor(lhs); rhs.apply_visitor(visitor); return lhs; } } // namespace sprout #endif // #ifndef SPROUT_VARIANT_IO_HPP