flyweight/doc/reference/key_value.html
2019-04-24 13:21:40 +02:00

125 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Flyweight Documentation - Key-value flyweights reference</title>
<link rel="stylesheet" href="../style.css" type="text/css">
<link rel="start" href="../index.html">
<link rel="prev" href="flyweight.html">
<link rel="up" href="index.html">
<link rel="next" href="tags.html">
</head>
<body>
<h1><img src="../../../../boost.png" alt="Boost logo" align=
"middle" width="277" height="86">Key-value flyweights reference</h1>
<div class="prev_link"><a href="flyweight.html"><img src="../prev.gif" alt="flyweight reference" border="0"><br>
<code>flyweight</code> reference
</a></div>
<div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.Flyweight reference" border="0"><br>
Boost.Flyweight reference
</a></div>
<div class="next_link"><a href="tags.html"><img src="../next.gif" alt="tags" border="0"><br>
Tags
</a></div><br clear="all" style="clear: all;">
<hr>
<h2>Contents</h2>
<ul>
<li><a href="#key_extractor">Key extractors</a></li>
<li><a href="#key_value_fwd_synopsis">Header
<code>"boost/flyweight/key_value_fwd.hpp"</code> synopsis</a>
</li>
<li><a href="#synopsis">Header
<code>"boost/flyweight/key_value.hpp"</code> synopsis</a>
<ul>
<li><a href="#key_value_construct">Class template <code>key_value</code></a></li>
</ul>
</li>
</ul>
<h2><a name="key_extractor">Key extractors</a></h2>
<p>
Let <code>Key</code> be a type with some implicit equivalence relationship
and <code>Value</code> a type constructible from <code>Key</code>.
A <a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a> type <code>KeyFromValue</code> is said
to be a key extractor from <code>Value</code> to <code>Key</code> if
<ol>
<li><code>kfv(cv)</code> is defined and have type <code>const Key&amp;</code>,</li>
<li><code>kfv(cv)</code> is equivalent to <code>kfv(Value(cv))</code>,</li>
<li><code>kfv(Value(k))</code> is equivalent to <code>k</code>,</li>
</ol>
for every <code>kfv</code> of type <code>const KeyFromValue</code>,
<code>cv</code> of type <code>const Value</code> and
<code>k</code> of type <code>Key</code>.
</p>
<h2><a name="key_value_fwd_synopsis">Header
<a href="../../../../boost/flyweight/key_value_fwd.hpp"><code>"boost/flyweight/key_value_fwd.hpp"</code></a> synopsis</a></h2>
<blockquote><pre>
<span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span>
<span class=keyword>namespace</span> <span class=identifier>flyweights</span><span class=special>{</span>
<span class=keyword>struct</span> <span class=identifier>no_key_from_value</span><span class=special>;</span>
<span class=keyword>template</span><span class=special>&lt;</span>
<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>
<span class=keyword>typename</span> <span class=identifier>KeyFromValue</span><span class=special>=</span><span class=identifier>no_key_from_value</span>
<span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>key_value</span><span class=special>;</span>
<span class=special>}</span> <span class=comment>// namespace boost::flyweights</span>
<span class=special>}</span> <span class=comment>// namespace boost</span>
</pre></blockquote>
<h2><a name="synopsis">Header
<a href="../../../../boost/flyweight/key_value.hpp"><code>"boost/flyweight/key_value.hpp"</code></a> synopsis</a></h2>
<h3><a name="key_value_construct">Class template <code>key_value</code></a></h3>
<p>
In <a href="flyweight.html#flyweight"><code>flyweight</code></a> instantiations
of the form <code>flyweight&lt;T,...&gt;</code>, the associated
<code>key_type</code> and <code>value_type</code> are both equal to <code>T</code>.
Instantiations of the form <code>flyweight&lt;key_value&lt;Key,Value[,KeyFromValue]&gt;,...&gt;</code>
allow to specify these types separately. <code>Key</code> and <code>Value</code>
must be different types. When provided, <code>KeyFromValue</code>
must be a <a href="#key_extractor"><code>Key Extractor</code></a> from
<code>Value</code> to <code>Key</code>.
</p>
<hr>
<div class="prev_link"><a href="flyweight.html"><img src="../prev.gif" alt="flyweight reference" border="0"><br>
<code>flyweight</code> reference
</a></div>
<div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.Flyweight reference" border="0"><br>
Boost.Flyweight reference
</a></div>
<div class="next_link"><a href="tags.html"><img src="../next.gif" alt="tags" border="0"><br>
Tags
</a></div><br clear="all" style="clear: all;">
<br>
<p>Revised April 24th 2019</p>
<p>&copy; Copyright 2006-2019 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</body>
</html>