Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/graph/test/lvalue_pmap.cpp @ 47

Last change on this file since 47 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

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