1// Copyright (C) 2013 Eurodecision
2// Authors: Guillaume Pinot
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#include <boost/property_map/compose_property_map.hpp>
9#include <iostream>
10
11int main()
12{
13 const int idx[] = {2, 0, 4, 1, 3};
14 double v[] = {1., 3., 0., 4., 2.};
15 boost::compose_property_map<double*, const int*> cpm(v, idx);
16
17 for (int i = 0; i < 5; ++i)
18 std::cout << get(m: cpm, k: i) << " ";
19 std::cout << std::endl;
20
21 for (int i = 0; i < 5; ++i)
22 ++cpm[i];
23
24 for (int i = 0; i < 5; ++i)
25 std::cout << get(m: cpm, k: i) << " ";
26 std::cout << std::endl;
27
28 for (int i = 0; i < 5; ++i)
29 put(m: cpm, k: i, v: 42.);
30
31 for (int i = 0; i < 5; ++i)
32 std::cout << get(m: cpm, k: i) << " ";
33 std::cout << std::endl;
34
35 return 0;
36}
37

source code of boost/libs/property_map/example/compose_property_map_example.cpp