2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-13 12:32:09 +00:00

Test and fix serialization code

[SVN r35257]
This commit is contained in:
Douglas Gregor
2006-09-21 17:02:14 +00:00
parent a03ed0e26d
commit d34d447b68
6 changed files with 96 additions and 6 deletions

View File

@@ -21,6 +21,15 @@
namespace boost {
namespace serialization {
// Turn off tracking for adjacency_list. It's not polymorphic, and we
// need to do this to enable saving of non-const adjacency lists.
template<class OEL, class VL, class D, class VP, class EP, class GP, class EL>
struct tracking_level<boost::adjacency_list<OEL,VL,D,VP,EP,GP,EL> > {
typedef mpl::integral_c_tag tag;
typedef mpl::int_<track_never> type;
BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
};
template<class Archive, class OEL, class VL, class D,
class VP, class EP, class GP, class EL>
inline void save(
@@ -76,7 +85,7 @@ inline void load(
while(V-- > 0){
Vertex v = add_vertex(graph);
verts[i++] = v;
ar >> graph[v];
ar >> get(vertex_all_t(), graph, v);
}
while(E-- > 0){
int u; int v;
@@ -84,7 +93,7 @@ inline void load(
ar >> BOOST_SERIALIZATION_NVP(v);
Edge e; bool inserted;
tie(e,inserted) = add_edge(verts[u], verts[v], graph);
ar >> graph[e];
ar >> get(edge_all_t(), graph, e);
}
}

View File

@@ -1717,12 +1717,22 @@ namespace boost {
return detail::get_dispatch(g, p, Kind());
}
template <class Config, class Base, class Property, class Key>
inline
typename boost::property_traits<
typename boost::property_map<typename Config::graph_type,
Property>::type
>::reference
get(Property p, adj_list_helper<Config, Base>& g, const Key& key) {
return get(get(p, g), key);
}
template <class Config, class Base, class Property, class Key>
inline
typename boost::property_traits<
typename boost::property_map<typename Config::graph_type,
Property>::const_type
>::value_type
>::reference
get(Property p, const adj_list_helper<Config, Base>& g, const Key& key) {
return get(get(p, g), key);
}