/Src/Dependencies/Boost/libs/property_map/doc/LvaluePropertyMap.html

http://hadesmem.googlecode.com/ · HTML · 145 lines · 110 code · 28 blank · 7 comment · 0 complexity · 2e42be0ab898c51869100bd0ddcccad1 MD5 · raw file

  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>LvaluePropertyMap</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:LvaluePropertyMap"></A>
  16. LvaluePropertyMap
  17. </H2>
  18. The LvaluePropertyMap provides an interface for accessing a
  19. reference to a property object (instead of a copy of the object as in
  20. the <TT>get()</TT> function required by <a
  21. href="./ReadablePropertyMap.html">ReadablePropertyMap</a>). An
  22. LvaluePropertyMap can be <I>mutable</I> or
  23. <I>non-mutable</I>. The mutable LvaluePropertyMap returns a
  24. reference whereas the non-mutable returns a const reference.
  25. <H3>Refinement of</H3>
  26. <a href="./ReadablePropertyMap.html">ReadablePropertyMap</a>
  27. for non-mutable or <a href="./ReadWritePropertyMap.html">ReadWritePropertyMap</a> for mutable property map.
  28. <h3>Notation</h3>
  29. <Table>
  30. <TR>
  31. <TD><tt>PMap</tt></TD>
  32. <TD>A type that is a model of LvaluePropertyMap.</TD>
  33. </TR>
  34. <TR>
  35. <TD><tt>pmap</tt></TD>
  36. <TD>An object of type <tt>PMap</tt>.</td>
  37. </TR>
  38. <TR>
  39. <TD><tt>key</tt></TD>
  40. <TD>An object of type <tt>boost::property_traits&lt;PMap&gt;::key_type</tt>.</td>
  41. </TR>
  42. </table>
  43. <h3>Associated Types</h3>
  44. <table border>
  45. <tr>
  46. <td>Reference Type</td>
  47. <td><TT>boost::property_traits&lt;PMap&gt;::reference</TT></td>
  48. <td>
  49. The reference type, which must be a reference or const reference to
  50. the value typeof the property map.
  51. </td>
  52. </tr>
  53. <tr>
  54. <td>Property Map Category
  55. <td><TT>boost::property_traits&lt;PMap&gt;::category</TT></td>
  56. <td>
  57. The category of the property: a type convertible to
  58. <TT>boost::lvalue_property_map_tag</TT>.
  59. </td>
  60. </tr>
  61. </table>
  62. <h3>Valid Expressions</h3>
  63. <table border>
  64. <tr>
  65. <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
  66. </tr>
  67. <tr>
  68. <td>Access Property Value </td>
  69. <TD><TT>pmap[key]</TT></TD>
  70. <TD>
  71. <TT>value_type&amp;</TT> for mutable, <TT>const value_type&amp;</TT>
  72. otherwise.
  73. </TD>
  74. <TD>Obtain a reference to the property identified by <TT>key</TT>.</TD>
  75. </TR>
  76. </TABLE>
  77. <h3>Concept Checking Class</h3>
  78. <pre> template &lt;class PMap, class Key&gt;
  79. struct LvaluePropertyMapConcept
  80. {
  81. typedef typename property_traits&lt;PMap&gt;::category Category;
  82. typedef boost::lvalue_property_map_tag LvalueTag;
  83. typedef const typename property_traits&lt;PMap&gt;::value_type&amp; const_reference;
  84. void constraints() {
  85. function_requires&lt; ReadWritePropertyMapConcept&lt;PMap, Key&gt; &gt;();
  86. function_requires&lt; ConvertibleConcept&lt;Category, LvalueTag&gt; &gt;();
  87. const_reference ref = pmap[k];
  88. }
  89. PMap pmap;
  90. Key k;
  91. };
  92. template &lt;class PMap, class Key&gt;
  93. struct Mutable_LvaluePropertyMapConcept
  94. {
  95. typedef typename property_traits&lt;PMap&gt;::category Category;
  96. typedef boost::lvalue_property_map_tag LvalueTag;
  97. typedef typename property_traits&lt;PMap&gt;::value_type&amp; reference;
  98. void constraints() {
  99. function_requires&lt; ReadWritePropertyMapConcept&lt;PMap, Key&gt; &gt;();
  100. function_requires&lt;ConvertibleConcept&lt;Category, LvalueTag&gt; &gt;();
  101. reference ref = pmap[k];
  102. }
  103. PMap pmap;
  104. Key k;
  105. };</pre>
  106. <h3>See Also</h3>
  107. <a href="./property_map.html">Property map concepts</a>
  108. <br>
  109. <HR>
  110. <TABLE>
  111. <TR valign=top>
  112. <TD nowrap>Copyright &copy 2000</TD><TD>
  113. <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>)
  114. </TD></TR></TABLE>
  115. </BODY>
  116. </HTML>