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
13using namespace boost;
14
15struct vertex_info_t
16{
17};
18struct edge_info_t
19{
20};
21namespace boost
22{
23BOOST_INSTALL_PROPERTY(vertex, info);
24BOOST_INSTALL_PROPERTY(edge, info);
25};
26
27typedef property< vertex_info_t, double > vertex_properties;
28typedef property< edge_info_t, double > edge_properties;
29
30typedef adjacency_list< vecS, vecS, bidirectionalS, vertex_properties,
31 edge_properties >
32 graph_t;
33
34double& foo_1(graph_t& x)
35{
36 property_map< graph_t, vertex_info_t >::type pmap = get(p: vertex_info_t(), g&: x);
37 return pmap[vertex(n: 0, x)];
38}
39
40const double& foo_2(graph_t const& x)
41{
42 property_map< graph_t, vertex_info_t >::const_type pmap
43 = get(p: vertex_info_t(), g: x);
44 return pmap[vertex(n: 0, x)];
45}
46
47double& bar_1(graph_t& x)
48{
49 property_map< graph_t, edge_info_t >::type pmap = get(p: edge_info_t(), g&: x);
50 return pmap[edge(u: vertex(n: 0, x), v: vertex(n: 1, x), g_: x).first];
51}
52
53const double& bar_2(graph_t const& x)
54{
55 property_map< graph_t, edge_info_t >::const_type pmap
56 = get(p: edge_info_t(), g: x);
57 return pmap[edge(u: vertex(n: 0, x), v: vertex(n: 1, x), g_: x).first];
58}
59
60int main() { return 0; }
61

source code of boost/libs/graph/test/lvalue_pmap.cpp