Hi folks,
I am having trouble incrementing the serialization version of a
regular class nested within a template class. I'm not sure if the
problem is with boost or with my own understanding of the issue.
My code looks like:
==============================
template
struct Foo
{
struct Bar
{
int data1;
int data2;
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, unsigned int version)
{
ar & data1;
if (version >= 2) {
ar & data2;
} else {
data2 = 0;
}
}
};
};
==============================
My attempt at setting the version looks like:
==============================
namespace boost {
namespace serialization {
template
struct version::Bar>
{
BOOST_STATIC_CONSTANT(unsigned int, value = 2);
};
} // namespace serialization
} // namespace boost
==============================
However, g++ gives an error:
==============================
main.cpp:31:8: error: template parameters not used in partial specialization:
main.cpp:31:8: error: ‘A’
main.cpp:31:8: error: ‘B’
==============================
Strangely, clang 3.0 compiles the code but issues some warnings:
==============================
main.cpp:31:8: warning: class template partial specialization contains
template parameters that can not be deduced;
this partial specialization will never be used
struct version::Bar>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:30:20: note: non-deducible template parameter 'A'
template
^
main.cpp:30:32: note: non-deducible template parameter 'B'
template
^
1 warning generated.
==============================
I'd appreciate any pointers!
Thanks,
-Gabe