10 May
2009
10 May
'09
2:14 a.m.
Damien Hocking wrote:
Hi all,
I'm using boost::serialization in a project and I was wondering if there's a way to deserialize through a non-default constructor that takes an argument. All the examples I've seen use default constructors.
Damien
In many situations, constructing off of the input archive like this works fine (assuming Foo is serializable): Foo::Foo( InputArchive& archive ) { archive >> boost::serialization::make_nvp( "FooClass", *this ); } This way, you could have additional constructor parameters besides the archive if you needed to, and your class doesn't have to have a default constructor.