]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/bidir_vec_remove_edge.cpp
ae662b124fec7e13b8609dcdd51f6c5ea4d30f2e
1 // (C) Copyright 2004 Douglas Gregor and Jeremy Siek
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // NOTE: This test illustrates a longstanding bug in the
7 // adjacency_list class template. We do not test it because it will
8 // cause problems until we have time to fix the bug. Annoying? Yes.
11 #include <boost/graph/adjacency_list.hpp>
12 #include <boost/core/lightweight_test.hpp>
19 int main(int, char*[])
22 typedef boost::adjacency_list
< boost::vecS
, boost::vecS
,
23 boost::bidirectionalS
, boost::no_property
, edge_prop
,
24 boost::no_property
, boost::vecS
>
26 typedef boost::graph_traits
< graph
>::edge_descriptor edge
;
30 edge_prop p1
= { 42 };
31 edge_prop p2
= { 17 };
32 add_edge(0, 1, p1
, g
);
33 add_edge(1, 0, p2
, g
);
35 edge e1
= boost::edge(0, 1, g
).first
;
36 edge e2
= boost::edge(1, 0, g
).first
;
37 BOOST_TEST(num_edges(g
) == 2);
38 BOOST_TEST(g
[e1
].weight
== 42);
39 BOOST_TEST(g
[e2
].weight
== 17);
41 BOOST_TEST(num_edges(g
) == 1);
43 // e2 has been invalidated, so grab it again
45 boost::tie(e2
, b2
) = boost::edge(1, 0, g
);
47 BOOST_TEST(g
[e2
].weight
== 17);
49 /* Now remove the other edge. Here, the fact that
50 * stored_ra_edge_iterator keeps an index but does not update it
51 * when edges are removed. So, this will be incorrect but the
52 * error may not always show up (use an STL debug mode to see the
57 return boost::report_errors();