WritablePropertyMap.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <HTML>
  2. <!--
  3. Copyright (c) Jeremy Siek 2000
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <Head>
  9. <Title>WritablePropertyMap</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H2><A NAME="concept:WritablePropertyMap"></A>
  16. Writable Property Map
  17. </H2>
  18. A Writable Property Map has the capability of setting the value
  19. object associated with the given key object via the <tt>put()</tt>
  20. function.
  21. <h3>Refinement of</h3>
  22. <a href="../../utility/CopyConstructible.html">Copy Constructible</a>
  23. <h3>Notation</h3>
  24. <Table>
  25. <TR>
  26. <TD><tt>PMap</tt></TD>
  27. <TD>A type that is a model of Writable Property Map.</TD>
  28. </TR>
  29. <TR>
  30. <TD><tt>pmap</tt></TD>
  31. <TD>An object of type <tt>PMap</tt>.</td>
  32. </TR>
  33. <TR>
  34. <TD><tt>key</tt></TD>
  35. <TD>An object of type <tt>boost::property_traits&lt;PMap&gt;::key_type</tt>.</td>
  36. </TR>
  37. <TR>
  38. <TD><tt>val</tt></TD>
  39. <TD>An object of type <tt>boost::property_traits&lt;PMap&gt;::value_type</tt>.</td>
  40. </TR>
  41. </table>
  42. <h3>Associated Types</h3>
  43. <table border>
  44. <tr>
  45. <td>Value Type</td>
  46. <td><TT>boost::property_traits&lt;PMap&gt;::value_type</TT></td>
  47. <td>
  48. The type of the property.
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>Key Type</td>
  53. <td><TT>boost::property_traits&lt;PMap&gt;::key_type</TT></td>
  54. <td>
  55. The type of the key object used to look up the property. The property
  56. map may be templated on the key type, in which case this typedef
  57. can be <TT>void</TT>.
  58. </td>
  59. </tr>
  60. <tr>
  61. <td>Property Map Category </td>
  62. <td><TT>boost::property_traits&lt;PMap&gt;::category</TT></td>
  63. <td>
  64. The category of the property: a type convertible to
  65. <TT>writable_property_map_tag</TT>.
  66. </td>
  67. </tr>
  68. </table>
  69. <h3>Valid Expressions</h3>
  70. <table border>
  71. <tr>
  72. <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
  73. </tr>
  74. <tr>
  75. <td>Put Property Value<a href="#1">[1]</a></td>
  76. <TD><TT>put(pmap, key, val)</TT></TD>
  77. <TD><TT>void</TT></TD>
  78. <TD>
  79. Assign <TT>val</TT> to the property associated with <TT>k</TT>.
  80. </TD>
  81. </TR>
  82. </TABLE>
  83. <h3>Notes</h3>
  84. <a name="1">[1]</a> The function <tt>put()</tt> was originally named
  85. <tt>set()</tt>, but was changed to avoid name conflicts with the
  86. <tt>std::set</tt> class when using a compiler (Microsoft Visual C++)
  87. with non-standard name lookup rules. The following example demonstrates
  88. the problem.
  89. <pre>#include &lt;set&gt;
  90. using namespace std;
  91. namespace boost {
  92. void set() { }
  93. }</pre>
  94. <h3>Concept Checking Class</h3>
  95. <pre> template &lt;class PMap, class Key&gt;
  96. struct WritablePropertyMapConcept
  97. {
  98. typedef typename property_traits&lt;PMap&gt;::key_type key_type;
  99. typedef typename property_traits&lt;PMap&gt;::category Category;
  100. typedef boost::writable_property_map_tag WritableTag;
  101. void constraints() {
  102. function_requires&lt; ConvertibleConcept&lt;Category, WritableTag&gt; &gt;();
  103. put(pmap, k, val);
  104. }
  105. PMap pmap;
  106. Key k;
  107. typename property_traits&lt;PMap&gt;::value_type val;
  108. };</pre>
  109. <h3>See Also</h3>
  110. <a href="./property_map.html">Property map concepts</a>
  111. <br>
  112. <HR>
  113. <TABLE>
  114. <TR valign=top>
  115. <TD nowrap>Copyright &copy 2000</TD><TD>
  116. <a HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)
  117. </TD></TR></TABLE>
  118. </BODY>
  119. </HTML>