1 //=======================================================================
2 // Copyright 2002 Indiana University.
3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //=======================================================================
9
10 #include <boost/graph/properties.hpp>
11 #include <boost/graph/adjacency_list.hpp>
12
13 using namespace boost;
14
15 struct vertex_info_t
16 {
17 };
18 struct edge_info_t
19 {
20 };
21 namespace boost
22 {
23 BOOST_INSTALL_PROPERTY(vertex, info);
24 BOOST_INSTALL_PROPERTY(edge, info);
25 };
26
27 typedef property< vertex_info_t, double > vertex_properties;
28 typedef property< edge_info_t, double > edge_properties;
29
30 typedef adjacency_list< vecS, vecS, bidirectionalS, vertex_properties,
31 edge_properties >
32 graph_t;
33
foo_1(graph_t & x)34 double& foo_1(graph_t& x)
35 {
36 property_map< graph_t, vertex_info_t >::type pmap = get(vertex_info_t(), x);
37 return pmap[vertex(0, x)];
38 }
39
foo_2(graph_t const & x)40 const double& foo_2(graph_t const& x)
41 {
42 property_map< graph_t, vertex_info_t >::const_type pmap
43 = get(vertex_info_t(), x);
44 return pmap[vertex(0, x)];
45 }
46
bar_1(graph_t & x)47 double& bar_1(graph_t& x)
48 {
49 property_map< graph_t, edge_info_t >::type pmap = get(edge_info_t(), x);
50 return pmap[edge(vertex(0, x), vertex(1, x), x).first];
51 }
52
bar_2(graph_t const & x)53 const double& bar_2(graph_t const& x)
54 {
55 property_map< graph_t, edge_info_t >::const_type pmap
56 = get(edge_info_t(), x);
57 return pmap[edge(vertex(0, x), vertex(1, x), x).first];
58 }
59
main()60 int main() { return 0; }
61