]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/bidir_vec_remove_edge.cpp
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/test/minimal.hpp>
19 test_main(int, char*[])
22 typedef boost::adjacency_list
<boost::vecS
, boost::vecS
, boost::bidirectionalS
,
23 boost::no_property
, edge_prop
, boost::no_property
, boost::vecS
> graph
;
24 typedef boost::graph_traits
<graph
>::edge_descriptor edge
;
28 edge_prop p1
= { 42 };
29 edge_prop p2
= { 17 };
30 add_edge(0, 1, p1
, g
);
31 add_edge(1, 0, p2
, g
);
33 edge e1
= boost::edge(0, 1, g
).first
;
34 edge e2
= boost::edge(1, 0, g
).first
;
35 BOOST_CHECK( num_edges(g
) == 2 );
36 BOOST_CHECK( g
[e1
].weight
== 42 );
37 BOOST_CHECK( g
[e2
].weight
== 17 );
39 BOOST_CHECK( num_edges(g
) == 1 );
41 // e2 has been invalidated, so grab it again
43 boost::tie(e2
, b2
) = boost::edge(1, 0, g
);
45 BOOST_CHECK( g
[e2
].weight
== 17 );
47 /* Now remove the other edge. Here, the fact that
48 * stored_ra_edge_iterator keeps an index but does not update it
49 * when edges are removed. So, this will be incorrect but the
50 * error may not always show up (use an STL debug mode to see the
56 return boost::exit_success
;