<!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="http://www.sgi.com/tech/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&</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><</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>></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<T,...></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<key_value<Key,Value[,KeyFromValue]>,...></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 September 15th 2008</p> <p>© Copyright 2006-2008 Joaquín M López Muñ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>