]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <!-- | |
3 | Copyright (c) 2013 Eurodecision | |
4 | Authors: Guillaume Pinot | |
5 | ||
6 | Distributed under the Boost Software License, Version 1.0. | |
7 | (See accompanying file LICENSE_1_0.txt or copy at | |
8 | http://www.boost.org/LICENSE_1_0.txt) | |
9 | --> | |
10 | ||
11 | <head> | |
12 | <title>Compose Property Map Adaptor</title> | |
13 | </head> | |
14 | ||
15 | <body bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b" | |
16 | alink="#ff0000"> | |
17 | <img src="../../../boost.png" | |
18 | alt="C++ Boost" width="277" height="86"> | |
19 | ||
20 | <br Clear> | |
21 | ||
22 | ||
23 | <h2> | |
24 | <a name="sec:compose-property-map"></a>Compose Property Map | |
25 | Adaptor | |
26 | </h2> | |
27 | ||
28 | <pre> | |
29 | compose_property_map<FPMap, GPMap> | |
30 | </pre> | |
31 | ||
32 | <p> | |
33 | This property map is an adaptor that composes two property map. The | |
34 | new property map will of the same model | |
35 | as <tt>FPMap</tt>. <tt>GPMap</tt> must | |
36 | model <a href="./ReadablePropertyMap.html">Readable Property Map</a>. | |
37 | </p> | |
38 | ||
39 | <h3>Example</h3> | |
40 | ||
41 | <a href="../example/compose_property_map_example.cpp">compose_property_map_example.cpp</a>: | |
42 | <pre> | |
43 | #include <boost/property_map/compose_property_map.hpp> | |
44 | #include <iostream> | |
45 | ||
46 | int main() | |
47 | { | |
48 | const int idx[] = {2, 0, 4, 1, 3}; | |
49 | double v[] = {1., 3., 0., 4., 2.}; | |
50 | boost::compose_property_map<double*, const int*> cpm(v, idx); | |
51 | ||
52 | for (int i = 0; i < 5; ++i) | |
53 | std::cout << get(cpm, i) << " "; | |
54 | std::cout << std::endl; | |
55 | ||
56 | for (int i = 0; i < 5; ++i) | |
57 | ++cpm[i]; | |
58 | ||
59 | for (int i = 0; i < 5; ++i) | |
60 | std::cout << get(cpm, i) << " "; | |
61 | std::cout << std::endl; | |
62 | ||
63 | for (int i = 0; i < 5; ++i) | |
64 | put(cpm, i, 42.); | |
65 | ||
66 | for (int i = 0; i < 5; ++i) | |
67 | std::cout << get(cpm, i) << " "; | |
68 | std::cout << std::endl; | |
69 | ||
70 | return 0; | |
71 | } | |
72 | </pre> | |
73 | ||
74 | <p>Output:</p> | |
75 | <pre> | |
76 | 0 1 2 3 4 | |
77 | 1 2 3 4 5 | |
78 | 42 42 42 42 42 | |
79 | </pre> | |
80 | ||
81 | <h3>Where Defined</h3> | |
82 | ||
83 | <p> | |
84 | <a href="../../../boost/property_map/compose_property_map.hpp"><tt>boost/property_map/compose_property_map.hpp</tt></a> | |
85 | </p> | |
86 | ||
87 | <h3>Template Parameters</h3> | |
88 | ||
89 | <P> | |
90 | ||
91 | <table border> | |
92 | ||
93 | <tr> | |
94 | <th>Parameter</th><th>Description</th> | |
95 | </tr> | |
96 | ||
97 | <tr> | |
98 | <td><tt>FPMap</tt></td> | |
99 | <td>Must be a property map of any kind.</td> | |
100 | </tr> | |
101 | ||
102 | <tr> | |
103 | <td><tt>GPMap</tt></td> | |
104 | <td>Must be a model of <a href="./ReadablePropertyMap.html">Readable Property Map</a>.</td> | |
105 | </tr> | |
106 | ||
107 | </table> | |
108 | ||
109 | <H3>Members</H3> | |
110 | ||
111 | <p> | |
112 | In addition to the methods and functions required by property maps, | |
113 | this class has the following members: | |
114 | </p> | |
115 | ||
116 | <hr> | |
117 | ||
118 | <pre> | |
119 | compose_property_map(const FPMap& f, const GPMap& g); | |
120 | </pre> | |
121 | Constructor. | |
122 | ||
123 | <hr> | |
124 | ||
125 | <h3>Non-Member functions</h3> | |
126 | ||
127 | <hr> | |
128 | ||
129 | <pre> | |
130 | template <class FPMap, class GPMap> | |
131 | compose_property_map<FPMap, GPMap> | |
132 | make_compose_property_map(const FPMap& f, const GPMap& g); | |
133 | </pre> | |
134 | Returns a <tt>compose_property_map</tt> using the given property maps type. | |
135 | ||
136 | <hr> | |
137 | ||
138 | <table> | |
139 | <tr valign="top"> | |
140 | <td nowrap>Copyright © 2013</td> | |
141 | <td>Eurodecision</td> | |
142 | </tr> | |
143 | <tr valign="top"> | |
144 | <td nowrap>Author:</td> | |
145 | <td>Guillaume Pinot</td> | |
146 | </tr> | |
147 | </table> | |
148 | ||
149 | </body> | |
150 | </html> |