Вопрос

I have a class which has a member graph which is a boost adjacency_list boost::adjacency_list<setS, setS, undirectedS, AINGNodeData, AINGEdgeData> graph;, would it be directly serializable ? How can I serialize it ? I use boost:serialization.

Это было полезно?

Решение

It should not be an issue. The class boost::adjacency_list<....> is serializable. See the file

#include <boost/graph/adj_list_serialize.hpp>

Simply make sure your properties AINGNodeData, AINGEdgeData are serializable, the library should take care of the rest. If properties are simple types or containers (e.g. std::string), it would be enough to make sure the proper serialization header is included, e.g.

#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>

Good luck.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top