1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0.1 Transitional//EN">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=ISO-8859-1">
6 <title>Boost.Flyweight Documentation - Holders reference
</title>
7 <link rel=
"stylesheet" href=
"../style.css" type=
"text/css">
8 <link rel=
"start" href=
"../index.html">
9 <link rel=
"prev" href=
"factories.html">
10 <link rel=
"up" href=
"index.html">
11 <link rel=
"next" href=
"locking.html">
15 <h1><img src=
"../../../../boost.png" alt=
"Boost logo" align=
16 "middle" width=
"277" height=
"86">Boost.Flyweight
17 Holders reference
</h1>
19 <div class=
"prev_link"><a href=
"factories.html"><img src=
"../prev.gif" alt=
"factories" border=
"0"><br>
22 <div class=
"up_link"><a href=
"index.html"><img src=
"../up.gif" alt=
"Boost.Flyweight reference" border=
"0"><br>
23 Boost.Flyweight reference
25 <div class=
"next_link"><a href=
"locking.html"><img src=
"../next.gif" alt=
"locking policies" border=
"0"><br>
27 </a></div><br clear=
"all" style=
"clear: all;">
34 <li><a href=
"#holder">Holders and holder specifiers
</a></li>
35 <li><a href=
"#holder_tag_synopsis">Header
36 <code>"boost/flyweight/holder_tag.hpp"</code> synopsis
</a>
38 <li><a href=
"#is_holder">Class template
<code>is_holder
</code></a></li>
39 <li><a href=
"#holder_construct">Class template
<code>holder
</code></a></li>
42 <li><a href=
"#static_holder_fwd_synopsis">Header
43 <code>"boost/flyweight/static_holder_fwd.hpp"</code> synopsis
</a>
45 <li><a href=
"#static_holder_synopsis">Header
46 <code>"boost/flyweight/static_holder.hpp"</code> synopsis
</a>
48 <li><a href=
"#static_holder_class">Class template
<code>static_holder_class
</code></a></li>
49 <li><a href=
"#static_holder">Class
<code>static_holder
</code></a></li>
52 <li><a href=
"#intermodule_holder_fwd_synopsis">Header
53 <code>"boost/flyweight/intermodule_holder_fwd.hpp"</code> synopsis
</a>
55 <li><a href=
"#intermodule_holder_synopsis">Header
56 <code>"boost/flyweight/intermodule_holder.hpp"</code> synopsis
</a>
58 <li><a href=
"#intermodule_holder_class">Class template
<code>intermodule_holder_class
</code></a></li>
59 <li><a href=
"#intermodule_holder">Class
<code>intermodule_holder
</code></a></li>
64 <h2><a name=
"holder">Holders and holder specifiers
</a></h2>
67 Given a type
<code>C
</code>, a type
<code>Holder
</code> is said to be a
<i>holder
68 of
<code>C
</code></i> if the expression
<code>Holder::get()
</code> returns
69 a reference to a default initialized
<code>C
</code> object unique to
70 <code>Holder
</code>. No invocation of
<code>Holder::get()
</code>, except possibly
71 the first one in the program, does throw.
72 <a href=
"flyweight.html#flyweight"><code>flyweight
</code></a>
73 privately uses a holder to instantiate a
<a href=
"factories.html#factory">factory
</a>
74 and some additional data (like a
<a href=
"locking.html#preliminary">mutex
</a> for
75 internal synchronization) unique to each instantiation type of the class template.
79 A type
<code>S
</code> is a
<i>holder specifier
</i> if:
81 <li>One of the following conditions is satisfied:
83 <li><a href=
"#is_holder"><code>is_holder
<S
>::type
</code></a> is
84 <a href=
"../../../mpl/doc/refmanual/bool.html"><code>boost::mpl::true_
</code></a>,
</li>
85 <li><code>S
</code> is of the form
<a href=
"#holder_construct"><code>holder
<S'
></code></a>.
</li>
88 <li><code>S
</code>, or
<code>S'
</code> if (b) applies, is an
89 <a href=
"../../../mpl/doc/refmanual/lambda-expression.html"><code>MPL Lambda
90 Expression
</code></a> such that invoking it with type
<code>C
</code> resolves to
91 a holder of
<code>C
</code>.
96 <h2><a name=
"holder_tag_synopsis">Header
97 <a href=
"../../../../boost/flyweight/holder_tag.hpp"><code>"boost/flyweight/holder_tag.hpp"</code></a> synopsis
</a></h2>
100 <span class=keyword
>namespace
</span> <span class=identifier
>boost
</span><span class=special
>{
</span>
102 <span class=keyword
>namespace
</span> <span class=identifier
>flyweights
</span><span class=special
>{
</span>
104 <span class=keyword
>struct
</span> <span class=identifier
>holder_marker
</span><span class=special
>;
</span>
106 <span class=keyword
>template
</span><span class=special
><</span><span class=keyword
>typename
</span> <span class=identifier
>T
</span><span class=special
>></span>
107 <span class=keyword
>struct
</span> <span class=identifier
>is_holder
</span><span class=special
>;
</span>
109 <span class=keyword
>template
</span><span class=special
><</span><span class=keyword
>typename
</span> <span class=identifier
>T
</span><span class=special
>></span>
110 <span class=keyword
>struct
</span> <span class=identifier
>holder
</span><span class=special
>;
</span>
112 <span class=special
>}
</span> <span class=comment
>// namespace boost::flyweights
</span>
114 <span class=special
>}
</span> <span class=comment
>// namespace boost
</span>
117 <h3><a name=
"is_holder">Class template
<code>is_holder
</code></a></h3>
120 Unless specialized by the user,
<code>is_holder
<T
>::type
</code> is
121 <a href=
"../../../mpl/doc/refmanual/bool.html"><code>boost::mpl::true_
</code></a>
122 if
<code>T
</code> is derived from
<code>holder_marker
</code>, and it is
123 <a href=
"../../../mpl/doc/refmanual/bool.html"><code>boost::mpl::false_
</code></a>
127 <h3><a name=
"holder_construct">Class template
<code>holder
</code></a></h3>
130 <code>holder
<T
></code> is a syntactic construct meant to indicate
131 that
<code>T
</code> is a holder specifier without resorting to the
132 mechanisms provided by the
<code>is_holder
</code> class template.
135 <h2><a name=
"static_holder_fwd_synopsis">Header
136 <a href=
"../../../../boost/flyweight/static_holder_fwd.hpp"><code>"boost/flyweight/static_holder_fwd.hpp"</code></a> synopsis
</a></h2>
139 <span class=keyword
>namespace
</span> <span class=identifier
>boost
</span><span class=special
>{
</span>
141 <span class=keyword
>namespace
</span> <span class=identifier
>flyweights
</span><span class=special
>{
</span>
143 <span class=keyword
>template
</span><span class=special
><</span><span class=keyword
>typename
</span> <span class=identifier
>C
</span><span class=special
>></span>
144 <span class=keyword
>struct
</span> <span class=identifier
>static_holder_class
</span><span class=special
>;
</span>
146 <span class=keyword
>struct
</span> <span class=identifier
>static_holder
</span><span class=special
>;
</span>
148 <span class=special
>}
</span> <span class=comment
>// namespace boost::flyweights
</span>
150 <span class=special
>}
</span> <span class=comment
>// namespace boost
</span>
154 <code>static_holder_fwd.hpp
</code> forward declares
155 <a href=
"#static_holder_class"><code>static_holder_class
</code></a>
156 and
<a href=
"#static_holder"><code>static_holder
</code></a>.
159 <h2><a name=
"static_holder_synopsis">Header
160 <a href=
"../../../../boost/flyweight/static_holder.hpp"><code>"boost/flyweight/static_holder.hpp"</code></a> synopsis
</a></h2>
162 <h3><a name=
"static_holder_class">Class template
<code>static_holder_class
</code></a></h3>
165 <code>static_holder_class
<C
></code> keeps its unique instance of
<code>C
</code> as a
169 <h3><a name=
"static_holder">Class
<code>static_holder
</code></a></h3>
172 <a href=
"#holder"><code>Holder Specifier
</code></a> for
<a href=
"#static_holder_class"><code>static_holder_class
</code></a>.
175 <h2><a name=
"intermodule_holder_fwd_synopsis">Header
176 <a href=
"../../../../boost/flyweight/intermodule_holder_fwd.hpp"><code>"boost/flyweight/intermodule_holder_fwd.hpp"</code></a> synopsis
</a></h2>
179 <span class=keyword
>namespace
</span> <span class=identifier
>boost
</span><span class=special
>{
</span>
181 <span class=keyword
>namespace
</span> <span class=identifier
>flyweights
</span><span class=special
>{
</span>
183 <span class=keyword
>template
</span><span class=special
><</span><span class=keyword
>typename
</span> <span class=identifier
>C
</span><span class=special
>></span>
184 <span class=keyword
>struct
</span> <span class=identifier
>intermodule_holder_class
</span><span class=special
>;
</span>
186 <span class=keyword
>struct
</span> <span class=identifier
>intermodule_holder
</span><span class=special
>;
</span>
188 <span class=special
>}
</span> <span class=comment
>// namespace boost::flyweights
</span>
190 <span class=special
>}
</span> <span class=comment
>// namespace boost
</span>
194 <code>intermodule_holder_fwd.hpp
</code> forward declares
195 <a href=
"#intermodule_holder_class"><code>intermodule_holder_class
</code></a>
196 and
<a href=
"#intermodule_holder"><code>intermodule_holder
</code></a>.
199 <h2><a name=
"intermodule_holder_synopsis">Header
200 <a href=
"../../../../boost/flyweight/intermodule_holder.hpp"><code>"boost/flyweight/intermodule_holder.hpp"</code></a> synopsis
</a></h2>
202 <h3><a name=
"intermodule_holder_class">Class template
<code>intermodule_holder_class
</code></a></h3>
205 <code>intermodule_holder_class
<C
></code> maintains a
<code>C
</code>
206 instance which is unique even across different dynamically linked modules of
207 the program using this same type. In general, this guarantee is not provided by
208 <a href=
"#static_holder_class"><code>static_holder_class
</code></a>, as most
209 C++ implementations are not able to merge duplicates of static variables stored
210 in different dynamic modules of a program.
213 <h3><a name=
"intermodule_holder">Class
<code>intermodule_holder
</code></a></h3>
216 <a href=
"#holder"><code>Holder Specifier
</code></a> for
<a href=
"#intermodule_holder_class"><code>intermodule_holder_class
</code></a>.
221 <div class=
"prev_link"><a href=
"factories.html"><img src=
"../prev.gif" alt=
"factories" border=
"0"><br>
224 <div class=
"up_link"><a href=
"index.html"><img src=
"../up.gif" alt=
"Boost.Flyweight reference" border=
"0"><br>
225 Boost.Flyweight reference
227 <div class=
"next_link"><a href=
"locking.html"><img src=
"../next.gif" alt=
"locking policies" border=
"0"><br>
229 </a></div><br clear=
"all" style=
"clear: all;">
233 <p>Revised August
11th
2008</p>
235 <p>© Copyright
2006-
2008 Joaqu
ín M L
ópez Mu
ñoz.
236 Distributed under the Boost Software
237 License, Version
1.0. (See accompanying file
<a href=
"../../../../LICENSE_1_0.txt">
238 LICENSE_1_0.txt
</a> or copy at
<a href=
"http://www.boost.org/LICENSE_1_0.txt">
239 http://www.boost.org/LICENSE_1_0.txt
</a>)