diff options
Diffstat (limited to 'libs/flyweight/doc/reference/flyweight.html')
-rw-r--r-- | libs/flyweight/doc/reference/flyweight.html | 72 |
1 files changed, 67 insertions, 5 deletions
diff --git a/libs/flyweight/doc/reference/flyweight.html b/libs/flyweight/doc/reference/flyweight.html index 009f5f387..c00715199 100644 --- a/libs/flyweight/doc/reference/flyweight.html +++ b/libs/flyweight/doc/reference/flyweight.html @@ -45,6 +45,7 @@ Key-value flyweights <li><a href="#modifiers">Modifiers</a></li> <li><a href="#comparison">Comparison operators</a></li> <li><a href="#specialized">Specialized algorithms</a></li> + <li><a href="#hash">Hash support</a></li> <li><a href="#config_macros">Configuration macros</a></li> </ul> </li> @@ -65,6 +66,7 @@ synopsis</a> </h2> <blockquote><pre> +<span class=preprocessor>#include</span> <span class=special><</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>functional</span><span class=special>/</span><span class=identifier>hash_fwd</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>></span> <span class=preprocessor>#include</span> <span class=special><</span><span class=identifier>iosfwd</span><span class=special>></span> <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> @@ -132,11 +134,30 @@ synopsis</a> <span class=keyword>using</span> <span class=identifier>flyweights</span><span class=special>::</span><span class=identifier>flyweight</span><span class=special>;</span> <span class=special>}</span> <span class=comment>// namespace boost</span> + +<span class=comment>// hash support:</span> + +<span class=keyword>namespace</span> <span class=identifier>std</span><span class=special>{</span> + +<span class=keyword>template</span><span class=special><</span><span class=keyword>class</span> <span class=identifier>T</span><span class=special>></span> <span class=keyword>struct</span> <span class=identifier>hash</span><span class=special>;</span> +<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Arg1</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Arg5</span><span class=special>></span> +<span class=keyword>struct</span> <span class=identifier>hash</span><span class=special><</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>flyweight</span><span class=special><</span><span class=identifier>T</span><span class=special>,</span><span class=identifier>Arg1</span><span class=special>,...,</span><span class=identifier>Arg5</span><span class=special>></span> <span class=special>>;</span> + +<span class=special>}</span> <span class=comment>// namespace std</span> + +<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>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Arg1</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Arg5</span><span class=special>></span> +<span class=keyword>inline</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=identifier>hash_value</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>flyweight</span><span class=special><</span><span class=identifier>T</span><span class=special>,</span><span class=identifier>Arg1</span><span class=special>,...,</span><span class=identifier>Arg5</span><span class=special>>&</span> <span class=identifier>x</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> <p> <code>flyweight_fwd.hpp</code> forward declares the class template -<a href="#flyweight"><code>flyweight</code></a> and its associated global functions. +<a href="#flyweight"><code>flyweight</code></a> and its associated global functions and class template specializations. </p> <h2> @@ -470,7 +491,7 @@ flyweight& operator=(value_type&& x);</code> <code>const key_type& get_key()const;</code> <blockquote> -<b>Return:</b> A copy of the key used to construct the +<b>Returns:</b> A copy of the key used to construct the <code>value_type</code> associated to the <code>flyweight</code> object.<br> <b>Exception safety:</b> If <code>flyweight</code> is not key-value or @@ -481,7 +502,7 @@ if <code>KeyFromValue</code> was not provided, <code>nothrow</code>. operator const value_type&()const;</code> <blockquote> -<b>Return:</b> The value associated to the <code>flyweight</code> +<b>Returns:</b> The value associated to the <code>flyweight</code> object.<br> <b>Exception safety:</b> <code>nothrow</code>. </blockquote> @@ -646,19 +667,60 @@ and assigns it to <code>x</code>.<br> <b>Returns:</b> <code>in</code>. </blockquote> +<h4><a name="hash">Hash support</a></h4> + +<p> +Support is provided for hashing <code>flyweight</code>s both with <code>std::hash</code> and +<a href="../../../../doc/html/hash.html"><code>boost::hash</code></a>. In either case, the calculation +does not involve hashing the associated <code>value_type</code> objects themselves; so, it is +immaterial whether <code>value_type</code> is hashable or not. +The results given by <code>std::hash</code> and <code>boost::hash</code> for the same +<code>flyweight</code> object will usually differ.<br /> +<b>Note:</b> Hash support can be <a href="#disable_hash_support">disabled</a> to solve +clashes with code where this has already been defined by the user. +</p> + +<code>namespace std{<br> +template<typename T,typename Arg1,...,typename Arg5><br> +struct hash<boost::flyweight<T,Arg1,...,Arg5> >;<br> +}</code> + +<blockquote> +This template specialization meets the requirements of class template <code>std::hash</code> in <b>[unord.hash]</b>. +No exception is thrown when invoking instances of this specialization. +</blockquote> + +<code>template<typename T,typename Arg1,...,typename Arg5><br> +inline std::size_t hash_value(const flyweight<T,Arg1,...,Arg5>& x);</code> + +<blockquote> +<b>Returns:</b> A hash value for <code>x</code> to be used by +<a href="../../../../doc/html/hash/custom.html">Boost.Hash</a>.<br> +<b>Exception safety:</b> <code>nothrow</code>. +</blockquote> + <h4><a name="config_macros">Configuration macros</a></h4> <a name="limit_num_ctor_args"> <code>BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS</code></a> <blockquote> -<b>Effects:</b> In compilers without variadic template support, +In compilers without variadic template support, globally define this macro to set the maximum number of arguments accepted by <code>flyweight</code> <a href="#fwd_ctor">forwarding constructor</a>, which by default is 5. </blockquote> +<a name="disable_hash_support"> +<code>BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT</code></a> + +<blockquote> +If defined, hash support is not provided. This can be useful to cope +with legacy code where general <code>flyweight</code> hashing has already been +defined by the user. +</blockquote> + <h2> <a name="serialize_synopsis">Header </a><a href="../../../../boost/flyweight/serialize.hpp"><code>"boost/flyweight/serialize.hpp"</code></a> @@ -722,7 +784,7 @@ Key-value flyweights <br> -<p>Revised September 3rd 2014</p> +<p>Revised November 11th 2014</p> <p>© Copyright 2006-2014 Joaquín M López Muñoz. Distributed under the Boost Software |