Consider following example:
#include <boost\property_tree\ptree.hpp>
#include <boost/any.hpp>
typedef boost::property_tree::ptree PT;
struct Foo
{
int bar;
int egg;
Foo(): bar(), egg() {}
};
int main()
{
Foo foo;
foo.bar = 5;
PT pt;
pt.put<Foo>("foo", foo);
return 0;
}
I'm new to boost and I'm willing to put a Foo object into property tree. The example above will not compile giving an error:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/boost/property_tree/stream_translator.hpp:33:13: error: no match for 'operator<<' in 's << e'
Can anyone suggest the right way to do it?