key_value.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  5. <title>Boost.Flyweight Documentation - Key-value flyweights reference</title>
  6. <link rel="stylesheet" href="../style.css" type="text/css">
  7. <link rel="start" href="../index.html">
  8. <link rel="prev" href="flyweight.html">
  9. <link rel="up" href="index.html">
  10. <link rel="next" href="tags.html">
  11. </head>
  12. <body>
  13. <h1><img src="../../../../boost.png" alt="Boost logo" align=
  14. "middle" width="277" height="86">Key-value flyweights reference</h1>
  15. <div class="prev_link"><a href="flyweight.html"><img src="../prev.gif" alt="flyweight reference" border="0"><br>
  16. <code>flyweight</code> reference
  17. </a></div>
  18. <div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.Flyweight reference" border="0"><br>
  19. Boost.Flyweight reference
  20. </a></div>
  21. <div class="next_link"><a href="tags.html"><img src="../next.gif" alt="tags" border="0"><br>
  22. Tags
  23. </a></div><br clear="all" style="clear: all;">
  24. <hr>
  25. <h2>Contents</h2>
  26. <ul>
  27. <li><a href="#key_extractor">Key extractors</a></li>
  28. <li><a href="#key_value_fwd_synopsis">Header
  29. <code>"boost/flyweight/key_value_fwd.hpp"</code> synopsis</a>
  30. </li>
  31. <li><a href="#synopsis">Header
  32. <code>"boost/flyweight/key_value.hpp"</code> synopsis</a>
  33. <ul>
  34. <li><a href="#key_value_construct">Class template <code>key_value</code></a></li>
  35. </ul>
  36. </li>
  37. </ul>
  38. <h2><a name="key_extractor">Key extractors</a></h2>
  39. <p>
  40. Let <code>Key</code> be a type with some implicit equivalence relationship
  41. and <code>Value</code> a type constructible from <code>Key</code>.
  42. A <a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
  43. Constructible</code></a> type <code>KeyFromValue</code> is said
  44. to be a key extractor from <code>Value</code> to <code>Key</code> if
  45. <ol>
  46. <li><code>kfv(cv)</code> is defined and have type <code>const Key&amp;</code>,</li>
  47. <li><code>kfv(cv)</code> is equivalent to <code>kfv(Value(cv))</code>,</li>
  48. <li><code>kfv(Value(k))</code> is equivalent to <code>k</code>,</li>
  49. </ol>
  50. for every <code>kfv</code> of type <code>const KeyFromValue</code>,
  51. <code>cv</code> of type <code>const Value</code> and
  52. <code>k</code> of type <code>Key</code>.
  53. </p>
  54. <h2><a name="key_value_fwd_synopsis">Header
  55. <a href="../../../../boost/flyweight/key_value_fwd.hpp"><code>"boost/flyweight/key_value_fwd.hpp"</code></a> synopsis</a></h2>
  56. <blockquote><pre>
  57. <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span>
  58. <span class=keyword>namespace</span> <span class=identifier>flyweights</span><span class=special>{</span>
  59. <span class=keyword>struct</span> <span class=identifier>no_key_from_value</span><span class=special>;</span>
  60. <span class=keyword>template</span><span class=special>&lt;</span>
  61. <span class=keyword>typename</span> <span class=identifier>Key</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>,</span>
  62. <span class=keyword>typename</span> <span class=identifier>KeyFromValue</span><span class=special>=</span><span class=identifier>no_key_from_value</span>
  63. <span class=special>&gt;</span>
  64. <span class=keyword>struct</span> <span class=identifier>key_value</span><span class=special>;</span>
  65. <span class=special>}</span> <span class=comment>// namespace boost::flyweights</span>
  66. <span class=special>}</span> <span class=comment>// namespace boost</span>
  67. </pre></blockquote>
  68. <h2><a name="synopsis">Header
  69. <a href="../../../../boost/flyweight/key_value.hpp"><code>"boost/flyweight/key_value.hpp"</code></a> synopsis</a></h2>
  70. <h3><a name="key_value_construct">Class template <code>key_value</code></a></h3>
  71. <p>
  72. In <a href="flyweight.html#flyweight"><code>flyweight</code></a> instantiations
  73. of the form <code>flyweight&lt;T,...&gt;</code>, the associated
  74. <code>key_type</code> and <code>value_type</code> are both equal to <code>T</code>.
  75. Instantiations of the form <code>flyweight&lt;key_value&lt;Key,Value[,KeyFromValue]&gt;,...&gt;</code>
  76. allow to specify these types separately. <code>Key</code> and <code>Value</code>
  77. must be different types. When provided, <code>KeyFromValue</code>
  78. must be a <a href="#key_extractor"><code>Key Extractor</code></a> from
  79. <code>Value</code> to <code>Key</code>.
  80. </p>
  81. <hr>
  82. <div class="prev_link"><a href="flyweight.html"><img src="../prev.gif" alt="flyweight reference" border="0"><br>
  83. <code>flyweight</code> reference
  84. </a></div>
  85. <div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.Flyweight reference" border="0"><br>
  86. Boost.Flyweight reference
  87. </a></div>
  88. <div class="next_link"><a href="tags.html"><img src="../next.gif" alt="tags" border="0"><br>
  89. Tags
  90. </a></div><br clear="all" style="clear: all;">
  91. <br>
  92. <p>Revised April 24th 2019</p>
  93. <p>&copy; Copyright 2006-2019 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
  94. Distributed under the Boost Software
  95. License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
  96. LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
  97. http://www.boost.org/LICENSE_1_0.txt</a>)
  98. </p>
  99. </body>
  100. </html>