Output of a boost::variant type using boost::spirit::karma
问题 I'm trying to output parameters, they can either be a single parameter or a vector of parameters. The following code does not what I'd like it to do: #include <iostream> #include <string> #include <boost/variant.hpp> #include <boost/spirit/include/karma.hpp> namespace karma = boost::spirit::karma; typedef std::vector<int> ParameterList; typedef boost::variant<int, ParameterList> Parameter; main() { using karma::int_; using karma::eol; using karma::lit; std::string generated; std::back_insert