boost-dynamic-bitset

Serialize boost::bimap with boost::dynamic_bitset as key value pair

混江龙づ霸主 提交于 2019-12-02 04:21:00
问题 I am interested to serialize a boost::bimap containing boost::dynamic_bitset so that I can save that and load back when needed. I have made an attempt to do that but I get many errors. The code that I have with me is as below. // Example program #include <iostream> #include <string> #include <fstream> #include <boost/bimap.hpp> #include <boost/dynamic_bitset.hpp> #include <boost/bimap/unordered_set_of.hpp> #include <boost/bimap/unordered_multiset_of.hpp> #include <boost/archive/binary

How to serialize boost::dynamic_bitset?

只谈情不闲聊 提交于 2019-11-28 00:17:33
How to serialize a class with a boost::dynamic_bitset member? #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/dynamic_bitset.hpp> #include <boost/serialization/bitset.hpp> #include <sstream> class A { friend class boost::serialization::access; boost::dynamic_bitset<> x; template<class Archive> void serialize(Archive & ar, const unsigned int){ ar & x; } }; int main() { A a; std::stringstream ss; boost::archive::text_oarchive oa(ss); oa << a; return 0; } Compiling gives an error (boost 1.57) In file included from /usr/include/boost