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