Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7474: compilation error in boost::serialization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-19 19:33:40
#7474: compilation error in boost::serialization
------------------------------------+---------------------------
Reporter: Like Gao <gao.like@â¦> | Owner: ramey
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: serialization
Version: Boost Release Branch | Severity: Problem
Resolution: invalid | Keywords:
------------------------------------+---------------------------
Changes (by ramey):
* status: reopened => closed
* resolution: => invalid
Comment:
The following compiles for me w/o problem.
Note that I made one change - I added "const" to the save member function.
{{{
//============================================================================
// Name : boost_bug.cpp
// Author :
// Version :
// Copyright : Your copyright notice
//============================================================================
#include <iostream>
#include <fstream>
#include <iostream>
#include <iostream>
#include <boost/archive/text_oarchive.hpp>
class MyClassA
{
public:
MyClassA(int x):xx(x){};
int xx;
private:
friend class boost::serialization::access;
template<class Archive>
void save(Archive & ar, const unsigned int version) const {
//ar << xx;
}
template<class Archive>
void load(Archive & ar, const unsigned int version) {
//ar >> xx;
}
BOOST_SERIALIZATION_SPLIT_MEMBER();
};
int main() {
MyClassA clsA(12);
std::ofstream f("/tmp/boost_clsA", std::ios::binary);
if (f.fail()) return -1;
boost::archive::text_oarchive oa(f);
oa << clsA;
f.close();
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7474#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC