Sync from upstream.

This commit is contained in:
Rene Rivera
2024-10-10 08:43:09 -05:00
9 changed files with 99 additions and 101 deletions

View File

@@ -85,12 +85,12 @@ Holders
<p>
Given a type <code>Key</code> and an
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>
type <code>Entry</code> implicitly convertible to <code>const Key&amp;</code>, a
<i>factory of <code>Entry</code> elements</i> (implicitly associated to
<code>Key</code>) is a
<a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a> entity able to store and retrieve immutable elements of
<a href="https://en.cppreference.com/w/cpp/named_req/DefaultConstructible"><code>DefaultConstructible</code></a>
entity able to store and retrieve immutable elements of
type <code>Entry</code>. A factory is governed by an associated equivalence
relation defined on <code>Key</code> so that no two
<code>Entry</code> objects convertible to equivalent <code>Key</code>s
@@ -101,7 +101,7 @@ use different equivalence relations.
<p>
In the following table, <code>Factory</code> is a factory of elements
of type <code>Entry</code>, <code>f</code> denotes an object of type <code>Factory</code>,
<code>x</code> is an object of type <code>Entry</code> and <code>h</code> is a
<code>x</code> denotes a non-const rvalue of type <code>Entry</code> and <code>h</code> is a
value of <code>Factory::handle_type</code>.
</p>
@@ -119,8 +119,9 @@ value of <code>Factory::handle_type</code>.
stored in the factory
</td>
<td><code>handle_type</code> is
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
and its copy and<br>
<a href="https://en.cppreference.com/w/cpp/named_req/CopyConstructible"><code>CopyConstructible</code></a>
and <a href="https://en.cppreference.com/w/cpp/named_req/CopyAssignable"><code>CopyAssignable</code></a><br>
and its copy and
assignment operations never throw an exception.
</td>
</tr>
@@ -270,7 +271,7 @@ implemented with a hashed container.
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>typedef</span> <b>implementation defined</b> <span class=identifier>handle_type</span><span class=special>;</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>Entry</span><span class=special>&amp;&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=keyword>void</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>entry</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=special>};</span>
@@ -278,27 +279,24 @@ implemented with a hashed container.
<p>
<code>Hash</code> is a
<a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a>
<a href="https://boost.org/sgi/stl/UnaryFunction.html"><code>Unary Function</code></a>
taking a single argument of type <code>Key</code> and returning a
value of type <code>std::size_t</code> in the range
<code>[0, std::numeric_limits&lt;std::size_t&gt;::max())</code>.
<a href="https://en.cppreference.com/w/cpp/named_req/DefaultConstructible"><code>DefaultConstructible</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/Hash"><code>Hash</code></a>
function object for arguments of type <code>Key</code>.
<code>Pred</code> is a
<a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a>
<a href="https://boost.org/sgi/stl/BinaryPredicate.html">
<code>Binary Predicate</code></a> inducing an equivalence relation
<a href="https://en.cppreference.com/w/cpp/named_req/DefaultConstructible"><code>DefaultConstructible</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/BinaryPredicate"><code>BinaryPredicate</code></a>
inducing an equivalence relation
on elements of <code>Key</code>. It is required that
a <code>Hash</code> object return the same value for objects
equivalent under <code>Pred</code>.
The equivalence relation on <code>Key</code> associated to the factory is
that induced by <code>Pred</code>.
The default arguments for <code>Hash</code> and <code>Pred</code> are
<a href="../../../functional/hash/index.html"><code>boost::hash&lt;Key&gt;</code></a>
<a href="../../../container_hash/index.html"><code>boost::hash&lt;Key&gt;</code></a>
and <code>std::equal_to&lt;Key&gt;</code>, respectively.
<code>Allocator</code> must be an allocator of <code>Entry</code> objects
satisfying the associated C++ requirements at <b>[lib.allocator.requirements]</b>.
<code>Allocator</code> must be an
<a href="https://en.cppreference.com/w/cpp/named_req/Allocator"><code>Allocator</code></a>
of <code>Entry</code> objects.
The default argument is <code>std::allocator&lt;Entry&gt;</code>. The internal
hashed container upon which <code>hashed_factory_class</code> is based is
constructed with default initialized objects of type <code>Hash</code>,
@@ -406,7 +404,7 @@ in a dedicated thread.
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>typedef</span> <b>implementation defined</b> <span class=identifier>handle_type</span><span class=special>;</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>Entry</span><span class=special>&amp;&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=keyword>void</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>entry</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=special>};</span>
@@ -414,27 +412,23 @@ in a dedicated thread.
<p>
<code>Hash</code> is a
<a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a>
<a href="https://boost.org/sgi/stl/UnaryFunction.html"><code>Unary Function</code></a>
taking a single argument of type <code>Key</code> and returning a
value of type <code>std::size_t</code> in the range
<code>[0, std::numeric_limits&lt;std::size_t&gt;::max())</code>.
<a href="https://en.cppreference.com/w/cpp/named_req/Hash"><code>Hash</code></a>
function object for arguments of type <code>Key</code>.
<code>Pred</code> is a
<a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a>
<a href="https://boost.org/sgi/stl/BinaryPredicate.html">
<code>Binary Predicate</code></a> inducing an equivalence relation
<a href="https://en.cppreference.com/w/cpp/named_req/DefaultConstructible"><code>DefaultConstructible</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/BinaryPredicate"><code>BinaryPredicate</code></a>
inducing an equivalence relation
on elements of <code>Key</code>. It is required that
a <code>Hash</code> object return the same value for objects
equivalent under <code>Pred</code>.
The equivalence relation on <code>Key</code> associated to the factory is
that induced by <code>Pred</code>.
The default arguments for <code>Hash</code> and <code>Pred</code> are
<a href="../../../functional/hash/index.html"><code>boost::hash&lt;Key&gt;</code></a>
<a href="../../../container_hash/index.html"><code>boost::hash&lt;Key&gt;</code></a>
and <code>std::equal_to&lt;Key&gt;</code>, respectively.
<code>Allocator</code> must be an allocator of <code>Entry</code> objects
satisfying the associated C++ requirements at <b>[lib.allocator.requirements]</b>.
<code>Allocator</code> must be an
<a href="https://en.cppreference.com/w/cpp/named_req/Allocator"><code>Allocator</code></a>
of <code>Entry</code> objects.
The default argument is <code>std::allocator&lt;Entry&gt;</code>. The internal
concurrent container upon which <code>concurrent_factory_class</code> is based is
constructed with default initialized objects of type <code>Hash</code>,
@@ -536,7 +530,7 @@ implemented on top of an orderded associative container.
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>typedef</span> <b>implementation defined</b> <span class=identifier>handle_type</span><span class=special>;</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>Entry</span><span class=special>&amp;&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=keyword>void</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>entry</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=special>};</span>
@@ -544,15 +538,15 @@ implemented on top of an orderded associative container.
<p>
<code>Compare</code> is a
<a href="https://boost.org/sgi/stl/DefaultConstructible.html"><code>Default
Constructible</code></a>
<a href="https://boost.org/sgi/stl/StrictWeakOrdering.html">
<code>Strict Weak Ordering</code></a> on <code>Key</code>. Two <code>Key</code>s
<a href="https://en.cppreference.com/w/cpp/named_req/DefaultConstructible"><code>DefaultConstructible</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/BinaryPredicate"><code>BinaryPredicate</code></a>
inducing a strict weak ordering on values of <code>Key</code>. Two <code>Key</code>s
<code>x</code> and <code>y</code> are considered equivalent if
<code>!c(x,y)&amp;&amp;!c(y,x)</code> for <code>c</code> of type <code>Compare</code>.
The default argument of <code>Compare</code> is <code>std::less&lt;Key&gt;</code>.
<code>Allocator</code> must be an allocator of <code>Entry</code> objects
satisfying the associated C++ requirements at <b>[lib.allocator.requirements]</b>.
<code>Allocator</code> must be an
<a href="https://en.cppreference.com/w/cpp/named_req/Allocator"><code>Allocator</code></a>
of <code>Entry</code> objects.
The default argument is <code>std::allocator&lt;Entry&gt;</code>. The internal
container upon which <code>set_factory_class</code> is based is
constructed with default initialized objects of type <code>Compare</code>
@@ -644,7 +638,7 @@ to provide a <a href="#factory"><code>Factory</code></a> interface.
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>typedef</span> <span class=keyword>typename</span> <span class=identifier>Container</span><span class=special>::</span><span class=identifier>iterator</span> <span class=identifier>handle_type</span><span class=special>;</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>const</span> <span class=keyword>typename</span> <span class=identifier>Container</span><span class=special>::</span><span class=identifier>value_type</span><span class=special>&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>typename</span> <span class=identifier>Container</span><span class=special>::</span><span class=identifier>value_type</span><span class=special>&amp;&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=keyword>void</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=keyword>const</span> <span class=keyword>typename</span> <span class=identifier>Container</span><span class=special>::</span><span class=identifier>value_type</span><span class=special>&amp;</span> <span class=identifier>entry</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=special>};</span>
@@ -716,7 +710,7 @@ Holders
<br>
<p>Revised September 20th 2024</p>
<p>Revised September 27th 2024</p>
<p>&copy; Copyright 2006-2024 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software

View File

@@ -324,7 +324,7 @@ of <code>flyweight</code> is a <i>key-value</i> flyweight.
<code>value_type</code> is the type of the values flyweight objects give access to,
while value lookup is based on associated <code>key_type</code> values.
<code>key_value</code> must be
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>
and <code>value_type</code> must be constructible from <code>key_type</code>;
additionally, <code>key_value</code> must
conform to any extra requirements imposed by the type of factory used.
@@ -443,10 +443,9 @@ explicit flyweight(const value_type&amp;&amp; x);<br>
explicit flyweight(value_type&amp;&amp; x);</code>
<blockquote>
<b>Requires:</b> If <code>flyweight</code> is key-value,
<code>value_type</code> is
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
and the
<b>Requires:</b>
<code>value_type</code> is constructible from the type of the argument.
If <code>flyweight</code> is key-value, the
<a href="key_value.html#key_extractor"><code>Key Extractor</code></a>
<code>KeyFromValue</code> must have been supplied as part of the
<code>key_value&lt;&gt;</code> construct.<br>
@@ -666,7 +665,7 @@ inline std::basic_istream&lt;ElemType,Traits&gt;&amp; operator&gt;&gt;(<br>
<blockquote>
<b>Requires:</b> If <code>flyweight</code> is key-value,
<code>value_type</code> is
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/CopyConstructible"><code>CopyConstructible</code></a>
and the
<a href="key_value.html#key_extractor"><code>Key Extractor</code></a>
<code>KeyFromValue</code> must have been supplied as part of the
@@ -680,7 +679,7 @@ and assigns it to <code>x</code>.<br>
<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
<a href="../../../container_hash/index.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
@@ -704,7 +703,7 @@ inline std::size_t hash_value(const flyweight&lt;T,Arg1,...,Arg5&gt;&amp; x) noe
<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>
<a href="../../../container_hash/doc/html/hash.html#user">Boost.ContainerHash</a>.<br>
</blockquote>
<h4><a name="config_macros">Configuration macros</a></h4>
@@ -792,7 +791,7 @@ Key-value flyweights
<br>
<p>Revised September 14th 2024</p>
<p>Revised September 28th 2024</p>
<p>&copy; Copyright 2006-2024 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software

View File

@@ -47,8 +47,8 @@ Tags
<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
A <a href="https://en.cppreference.com/w/cpp/named_req/DefaultConstructible"><code>DefaultConstructible</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>
@@ -111,9 +111,9 @@ Tags
<br>
<p>Revised April 24th 2019</p>
<p>Revised September 27th 2024</p>
<p>&copy; Copyright 2006-2019 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2006-2024 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">

View File

@@ -72,7 +72,7 @@ helper associated to a <a href="factories.html#factory">factory</a> type
is a value of
<code>Factory::handle_type</code> associated to a <code>Factory</code> <code>f</code>
and <code>check</code> is a value of
a <a href="https://boost.org/sgi/stl/Predicate.html"><code>Predicate</code></a>
a <a href="https://en.cppreference.com/w/cpp/named_req/Predicate"><code>Predicate</code></a>
type <code>Checker</code> with argument of type <code>Factory::handle_type</code>.
</p>
@@ -131,9 +131,9 @@ A type <code>Tracking</code> is a tracking policy if:
<a href="../../../mpl/doc/refmanual/lambda-expression.html"><code>MPL Lambda
Expression</code></a> that resolves, when invoked with different types
(<code>Value</code>,<code>Key</code>) such that <code>Value</code> is
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
and implicitly convertible to <code>const Key&amp;</code>, to an
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>
and implicitly convertible to <code>const Key&amp;</code>, to a
<a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>
type <code>Entry</code> implicitly convertible to both <code>const Value&amp;</code>
and <code>const Key&amp;</code>.
</li>
@@ -143,10 +143,12 @@ A type <code>Tracking</code> is a tracking policy if:
Expression</code></a>; this expression, when invoked with types
(<code>InternalHandle</code>,<a href="#preliminary"><code>TrackingHelper</code></a>),
with <code>InternalHandle</code> being
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
<a href="https://en.cppreference.com/w/cpp/named_req/CopyConstructible"><code>CopyConstructible</code></a>
and <a href="https://en.cppreference.com/w/cpp/named_req/CopyAssignable"><code>CopyAssignable</code></a>
and providing the nothrow guarantee for copy and assignment,
resolves to an
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>
resolves to a
<a href="https://en.cppreference.com/w/cpp/named_req/CopyConstructible"><code>CopyConstructible</code></a>
and <a href="https://en.cppreference.com/w/cpp/named_req/CopyAssignable"><code>CopyAssignable</code></a>
type <code>Handle</code> which also provides the nothrow guarantee for
copy and assignment and is constructible from and implicitly
convertible to <code>InternalHandle</code>.
@@ -278,9 +280,9 @@ Performance
<br>
<p>Revised April 24th 2019</p>
<p>Revised September 27th 2024</p>
<p>&copy; Copyright 2006-2019 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2006-2024 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">

View File

@@ -57,7 +57,7 @@ Acknowledgements
<ul>
<li>Added <a href="tutorial/configuration.html#concurrent_factory"><code>concurrent_factory</code></a>,
a factory based on a concurrent container from
<a href="../../serialization/index.html">Boost.Unordered</a>
<a href="../../unordered/index.html">Boost.Unordered</a>
that provides excellent performance in multithreaded scenarios.</li>
<li>Marked as <code>noexcept</code> those <code>boost::flyweight</code>
operations previously documented as not throwing
@@ -140,7 +140,7 @@ Acknowledgements
<p>
<ul>
<li>Added hash support both with <code>std::hash</code> and
<a href="../../../doc/html/hash.html"><code>boost::hash</code></a>. This
<a href="../../container_hash/index.html"><code>boost::hash</code></a>. This
can be optionally <a href="reference/flyweight.html#disable_hash_support">disabled</a>
to avoid clashes with legacy code where this support has already been defined by
the user.
@@ -257,7 +257,7 @@ Acknowledgements
<br>
<p>Revised September 17th 2024</p>
<p>Revised September 29th 2024</p>
<p>&copy; Copyright 2006-2024 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software

View File

@@ -219,17 +219,17 @@ for an illustration of use of Boost.Flyweight serialization capabilities.
<p>
For <code>flyweight&lt;T&gt;</code> to be instantiable, <code>T</code> must
be <a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>,
<a href="https://boost.org/sgi/stl/EqualityComparable.html"><code>Equality
Comparable</code></a> and must interoperate with
<a href="../../../functional/hash/index.html">Boost.Hash</a>.
be <a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>,
<a href="https://en.cppreference.com/w/cpp/named_req/EqualityComparable"><code>EqualityComparable</code></a>
and must interoperate with
<a href="../../../container_hash/index.html">Boost.ContainerHash</a>.
The first requirement is probably met without any extra effort by the user,
not so the other two, except for the most common basic types of C++
and the standard library. Equality and hashing of <code>T</code> are used
internally by <code>flyweight&lt;T&gt;</code> internal factory to maintain the
common repository of unique <code>T</code> values referred to by the flyweight
objects. Consult the Boost.Hash documentation
<a href="../../../../doc/html/hash/custom.html">section</a> on extending
<a href="../../../container_hash/doc/html/hash.html#user">section</a> on extending
that library for custom data types.
</p>
@@ -257,9 +257,9 @@ Key-value flyweights
<br>
<p>Revised March 17th 2023</p>
<p>Revised September 28th 2024</p>
<p>&copy; Copyright 2006-2023 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2006-2024 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">

View File

@@ -231,13 +231,12 @@ type <code>boost::mpl::_1</code> can be used.
This specifier, which Boost.Flyweight takes by default, controls the usage of a
factory internally based on a hash container. Values are determined to be
equivalent by means of the
<a href="https://boost.org/sgi/stl/BinaryPredicate.html"><code>Binary
Predicate</code></a> <code>Pred</code>, and indexed into the factory container
using <code>Hash</code>, which is assumed to be a <i>hash function</i>,
i.e. a
<a href="https://boost.org/sgi/stl/UnaryFunction.html"><code>Unary
Function</code></a> assigning to each value a hash identifier of
type <code>std::size_t</code>. The <code>Allocator</code> parameter is
<a href="https://en.cppreference.com/w/cpp/named_req/BinaryPredicate"><code>BinaryPredicate</code></a>
<code>Pred</code>, and indexed into the factory container
using <code>Hash</code>, which is assumed to be a
<a href="https://en.cppreference.com/w/cpp/named_req/Hash"><code>Hash</code></a>
function object for arguments of type <code>Key</code>.
The <code>Allocator</code> parameter is
used by the factory container for its memory allocation needs. The default
types for these parameters are such that the expression
</p>
@@ -352,8 +351,8 @@ with the same meaning as in <a href="#hashed_factory"><code>hashed_factory</code
<code>set_factory</code> resorts to an <code>std::set</code>-like ordered
container for the implementation of the flyweight factory.
<code>Compare</code> must be a
<a href="https://boost.org/sgi/stl/StrictWeakOrdering.html"><code>Strict
Weak Ordering</code></a> on the value type <code>flyweight</code> is
<a href="https://en.cppreference.com/w/cpp/named_req/BinaryPredicate"><code>BinaryPredicate</code></a>
inducing a strict weak ordering on the value type <code>flyweight</code> is
acting upon; as is customary with STL ordered containers, two values
are considered equivalent if none is less than the other according to <code>Pred</code>.
<code>Allocator</code> is an allocator type passed along to the factory
@@ -408,8 +407,10 @@ a container of <code>Entry</code> elements satisfying the following
requirements:
<ol>
<li>The container type must be a model of
<a href="https://boost.org/sgi/stl/UniqueAssociativeContainer.html"><code>Unique
Associative Container</code></a> where equivalence of <code>Entry</code>s
<a href="https://en.cppreference.com/w/cpp/named_req/AssociativeContainer"><code>AssociativeContainer</code></a>
or
<a href="https://en.cppreference.com/w/cpp/named_req/UnorderedAssociativeContainer"><code>UnorderedAssociativeContainer</code></a>
with unique keys, where equivalence of <code>Entry</code>s
is determined by the <code>key_type</code> values the entries are convertible
to.
</li>
@@ -694,7 +695,7 @@ Extending Boost.Flyweight
<br>
<p>Revised September 18th 2024</p>
<p>Revised September 27th 2024</p>
<p>&copy; Copyright 2006-2024 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software

View File

@@ -83,10 +83,10 @@ though their expected interface is much more concise:
<span class=keyword>template</span><span class=special>&lt;</span><span class=keyword>typename</span> <span class=identifier>Entry</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Key</span><span class=special>&gt;</span>
<span class=keyword>class</span> <span class=identifier>custom_factory_class</span>
<span class=special>{</span>
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>typedef</span> <span class=special>...</span> <span class=identifier>handle_type</span><span class=special>;</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>Entry</span><span class=special>&amp;&amp;</span> <span class=identifier>x</span><span class=special>);</span>
<span class=keyword>void</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>entry</span><span class=special>(</span><span class=identifier>handle_type</span> <span class=identifier>h</span><span class=special>);</span>
<span class=special>};</span>
@@ -133,9 +133,9 @@ functionality on a regular <code>std::set</code>:
<span class=keyword>public</span><span class=special>:</span>
<span class=keyword>typedef</span> <span class=keyword>typename</span> <span class=identifier>store_type</span><span class=special>::</span><span class=identifier>iterator</span> <span class=identifier>handle_type</span><span class=special>;</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>Entry</span><span class=special>&amp;</span> <span class=identifier>x</span><span class=special>)</span>
<span class=identifier>handle_type</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>Entry</span><span class=special>&amp;&amp;</span> <span class=identifier>x</span><span class=special>)</span>
<span class=special>{</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special>&lt;</span><span class=identifier>handle_type</span><span class=special>,</span> <span class=keyword>bool</span><span class=special>&gt;</span> <span class=identifier>p</span><span class=special>=</span><span class=identifier>store</span><span class=special>.</span><span class=identifier>insert</span><span class=special>(</span><span class=identifier>x</span><span class=special>);</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special>&lt;</span><span class=identifier>handle_type</span><span class=special>,</span> <span class=keyword>bool</span><span class=special>&gt;</span> <span class=identifier>p</span><span class=special>=</span><span class=identifier>store</span><span class=special>.</span><span class=identifier>insert</span><span class=special>(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>move</span><span class=special>(</span><span class=identifier>x</span><span class=special>));</span>
<span class=keyword>if</span><span class=special>(</span><span class=identifier>p</span><span class=special>.</span><span class=identifier>second</span><span class=special>){</span> <span class=comment>/* new entry */</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span><span class=special>&lt;&lt;</span><span class=string>&quot;new: &quot;</span><span class=special>&lt;&lt;(</span><span class=keyword>const</span> <span class=identifier>Key</span><span class=special>&amp;)</span><span class=identifier>x</span><span class=special>&lt;&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;</span>
<span class=special>}</span>
@@ -549,9 +549,9 @@ Technical issues
<br>
<p>Revised September 1st 2014</p>
<p>Revised September 27th 2024</p>
<p>&copy; Copyright 2006-2014 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2006-2024 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">

View File

@@ -192,17 +192,19 @@ Many of the requirements imposed on <code>T</code> for
<a href="basics.html#requirements">regular flyweights</a> move to the key
type in the case of a key-value <code>flyweight&lt;key_value&lt;K,T&gt; &gt;</code>.
Now it is <code>K</code> that must be
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>,
<a href="https://boost.org/sgi/stl/EqualityComparable.html"><code>Equality
Comparable</code></a> and interoperate with
<a href="../../../functional/hash/index.html">Boost.Hash</a>, where equality and
<a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>,
<a href="https://en.cppreference.com/w/cpp/named_req/EqualityComparable"><code>EqualityComparable</code></a>
and interoperate with
<a href="../../../container_hash/index.html">Boost.ContainerHash</a>, where equality and
hash compatibility are requirements imposed by the default internal factory of
Boost.Flyweight and can change if this factory is further configured or replaced
by the user. The only requisite retained on <code>T</code> is that it must be
constructible from <code>K</code>; only in the case that a flyweight is directly
assigned a <code>T</code> object is also <code>T</code> required to be
<a href="https://boost.org/sgi/stl/Assignable.html"><code>Assignable</code></a>.
To serialize objects of type <code>flyweight&lt;key_value&lt;K,T&gt; &gt;</code>
<a href="https://en.cppreference.com/w/cpp/named_req/CopyConstructible"><code>CopyConstructible</code></a>
(or <a href="https://en.cppreference.com/w/cpp/named_req/MoveConstructible"><code>MoveConstructible</code></a>
if assigned a <code>T&amp;&amp;</code>).
To serialize objects of type <code>flyweight&lt;key_value&lt;K,T&gt; &gt;</code>,
only <code>K</code> needs to be serializable.
</p>
@@ -220,9 +222,9 @@ Configuring Boost.Flyweight
<br>
<p>Revised April 24th 2019</p>
<p>Revised September 27th 2024</p>
<p>&copy; Copyright 2006-2019 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2006-2024 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">