...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
"boost/flyweight/holder_tag.hpp"
synopsis
"boost/flyweight/static_holder_fwd.hpp"
synopsis
"boost/flyweight/static_holder.hpp"
synopsis
"boost/flyweight/intermodule_holder_fwd.hpp"
synopsis
"boost/flyweight/intermodule_holder.hpp"
synopsis
Given a type C
, a type Holder
is said to be a holder
of C
if the expression Holder::get()
returns
a reference to a default initialized C
object unique to
Holder
. No invocation of Holder::get()
, except possibly
the first one in the program, does throw.
flyweight
privately uses a holder to instantiate a factory
and some additional data (like a mutex for
internal synchronization) unique to each instantiation type of the class template.
A type S
is a holder specifier if:
is_holder<S>::type
is
boost::mpl::true_
,S
is of the form holder<S'>
.S
, or S'
if (b) applies, is an
MPL Lambda
Expression
such that invoking it with type C
resolves to
a holder of C
.
"boost/flyweight/holder_tag.hpp"
synopsisnamespace boost{ namespace flyweights{ struct holder_marker; template<typename T> struct is_holder; template<typename T> struct holder; } // namespace boost::flyweights } // namespace boost
is_holder
Unless specialized by the user, is_holder<T>::type
is
boost::mpl::true_
if T
is derived from holder_marker
, and it is
boost::mpl::false_
otherwise.
holder
holder<T>
is a syntactic construct meant to indicate
that T
is a holder specifier without resorting to the
mechanisms provided by the is_holder
class template.
"boost/flyweight/static_holder_fwd.hpp"
synopsisnamespace boost{ namespace flyweights{ template<typename C> struct static_holder_class; struct static_holder; } // namespace boost::flyweights } // namespace boost
static_holder_fwd.hpp
forward declares
static_holder_class
and static_holder
.
"boost/flyweight/static_holder.hpp"
synopsisstatic_holder_class
static_holder_class<C>
keeps its unique instance of C
as a
local static object.
static_holder
Holder Specifier
for static_holder_class
.
"boost/flyweight/intermodule_holder_fwd.hpp"
synopsisnamespace boost{ namespace flyweights{ template<typename C> struct intermodule_holder_class; struct intermodule_holder; } // namespace boost::flyweights } // namespace boost
intermodule_holder_fwd.hpp
forward declares
intermodule_holder_class
and intermodule_holder
.
"boost/flyweight/intermodule_holder.hpp"
synopsisintermodule_holder_class
intermodule_holder_class<C>
maintains a C
instance which is unique even across different dynamically linked modules of
the program using this same type. In general, this guarantee is not provided by
static_holder_class
, as most
C++ implementations are not able to merge duplicates of static variables stored
in different dynamic modules of a program.
intermodule_holder
Holder Specifier
for intermodule_holder_class
.
Revised August 11th 2008
© Copyright 2006-2008 Joaquín M López Muñoz. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)