Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/graph/example/graph-property-iter-eg.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.1 KB
Line 
1//=======================================================================
2// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
3//
4// Distributed under the Boost Software License, Version 1.0. (See
5// accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//=======================================================================
8
9#include <boost/config.hpp>
10#include <string>
11#include <iostream>
12#include <boost/graph/adjacency_list.hpp>
13#include <boost/graph/property_iter_range.hpp>
14
15int
16main()
17{
18  using namespace boost;
19  typedef adjacency_list < listS, vecS, directedS,
20    property < vertex_name_t, std::string > >graph_t;
21  graph_t g(3);
22
23  const char *vertex_names[] = { "Kubrick", "Clark", "Hal" };
24  int i = 0;
25  graph_property_iter_range < graph_t, vertex_name_t >::iterator v, v_end;
26  for (tie(v, v_end) = get_property_iter_range(g, vertex_name);
27       v != v_end; ++v, ++i)
28    *v = vertex_names[i];
29
30  tie(v, v_end) = get_property_iter_range(g, vertex_name);
31  std::copy(v, v_end, std::ostream_iterator < std::string > (std::cout, " "));
32  std::cout << std::endl;
33  return 0;
34}
Note: See TracBrowser for help on using the repository browser.