compose_property_map.html 2.9 KB

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