I just compiled, linked and ran the following program on my system:
vc 7.1
Boost 1.35 - HEAD
There was no need to explicitly instantiate anything.
Robert Ramey
#include
#include
#include
#include
class CSerTest
{
std::string a_, b_, c_;
friend class boost::serialization::access;
template<class Archive>
void serialize( Archive & ar, const unsigned int );
public:
CSerTest();
};
BOOST_CLASS_VERSION(CSerTest, 1);
// Class.cpp
#include
#include
CSerTest::CSerTest() : a_("1"), b_("2"), c_("3")
{
}
template<class Archive>
void CSerTest::serialize( Archive & ar, const unsigned int )
{
ar & BOOST_SERIALIZATION_NVP(a_) & BOOST_SERIALIZATION_NVP(b_) &
BOOST_SERIALIZATION_NVP(c_);
}
// main.cpp
#include <fstream>
///////////////////////// without effect
////////////////////////////////////
//template void
CSerTest::serializeboost::archive::xml_oarchive(boost::archive::xml_oarchive&,
unsigned int );
int main()
{
const CSerTest instance;
std::ofstream ofs( "out_file.txt" );
boost::archive::xml_oarchive oxa( ofs );
oxa << BOOST_SERIALIZATION_NVP(instance);
}