Commit 61ff41b3 authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

fixed bug in InputArchive

parent abc24081
...@@ -44,7 +44,9 @@ class InputArchive : public iarchive { ...@@ -44,7 +44,9 @@ class InputArchive : public iarchive {
template<typename ... Args> template<typename ... Args>
InputArchive(DataStore&& datastore, Args&& ... args) InputArchive(DataStore&& datastore, Args&& ... args)
: iarchive(std::forward<Args>(args)..., boost::archive::archive_flags::no_header) : iarchive(std::forward<Args>(args)..., boost::archive::archive_flags::no_header)
, m_datastore(std::move(datastore)) {} , m_datastore(std::move(datastore)) {
init(boost::archive::archive_flags::no_header);
}
/** /**
* @brief Constructor. * @brief Constructor.
...@@ -56,7 +58,9 @@ class InputArchive : public iarchive { ...@@ -56,7 +58,9 @@ class InputArchive : public iarchive {
template<typename ... Args> template<typename ... Args>
InputArchive(const DataStore& datastore, Args&& ... args) InputArchive(const DataStore& datastore, Args&& ... args)
: iarchive(std::forward<Args>(args)..., boost::archive::archive_flags::no_header) : iarchive(std::forward<Args>(args)..., boost::archive::archive_flags::no_header)
, m_datastore(datastore) {} , m_datastore(datastore) {
init(boost::archive::archive_flags::no_header);
}
/** /**
* @brief Returns the DataStore used when creating the InputArchive. * @brief Returns the DataStore used when creating the InputArchive.
...@@ -69,4 +73,7 @@ class InputArchive : public iarchive { ...@@ -69,4 +73,7 @@ class InputArchive : public iarchive {
} }
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(hepnos::InputArchive)
BOOST_SERIALIZATION_REGISTER_ARCHIVE(hepnos::InputArchive)
#endif #endif
...@@ -37,20 +37,23 @@ class TestObjectB { ...@@ -37,20 +37,23 @@ class TestObjectB {
int& a() { return _a; } int& a() { return _a; }
std::string& b() { return _b; } std::string& b() { return _b; }
std::vector<char>& c() { return _c; }
bool operator==(const TestObjectB& other) const { bool operator==(const TestObjectB& other) const {
return _a == other._a && _b == other._b; return _a == other._a && _b == other._b && _c == other._c;
} }
private: private:
int _a; int _a;
std::string _b; std::string _b;
std::vector<char> _c;
template<typename Archive> template<typename Archive>
void serialize(Archive& ar, const unsigned int version) { void serialize(Archive& ar, const unsigned int version) {
ar & _a; ar & _a;
ar & _b; ar & _b;
ar & _c;
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment