Hi,
In the following code I show how a boost::variant that has a boost::blank
cannot be serialized, and a proposed fix. I argue that this should work out
of the box. This is with Boost 1.42.0.
Am I doing something wrong here, or is serialization of boost::blank
somewhere already?
Thanks
#include
#include
#include
#include <sstream>
#ifdef FIX
// suggested fix: non-intrusive serialize() for boost::blank
namespace boost { namespace serialization
{
template<class Archive>
void serialize(Archive &, boost::blank &, const unsigned int)
{
// Nothing to do here
}
} }
#endif
int main()
{
boost::variant v1 = 666;
boost::variant v2 = 666;
std::ostringstream os;
boost::archive::text_oarchive oa(os);
// works!
oa << v1;
// compile error about boost::blank not having a serialize method
// #define FIX to compile
oa << v2;
return 0;
}