I have a Map std::map, which comes from the boost::program_options package. Now I would like to print the content o
Rather than re-writing my class to use boost::spirit::hold_any, I created a way to stream boost::any, similar to what manifest suggested, but just in one place.
ostream& operator<<(ostream& _os, const boost::any& _any)
{
// only define simple type conversions
if (_any.type() == typeid(int))
_os << boost::any_cast(_any);
/*any other types you use...*/
}
Rather cumbersome, but it allows me to stream a boost::any variable anywhere in my code.
How about being able to construct a boost::spirit::hold_any from a boost:any?