]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/example/graph-property-iter-eg.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / graph / example / graph-property-iter-eg.cpp
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
15 int
16 main()
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 (boost::tie(v, v_end) = get_property_iter_range(g, vertex_name);
27 v != v_end; ++v, ++i)
28 *v = vertex_names[i];
29
30 boost::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 }