From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-11-12 18:35:34
After a year since the last published draft, I think the
flyweight library I'm working on is in a sufficiently
polished state to issue a request for comments on its
usefulness and eventual suitability for inclusion into the
Boost review queue.
* Abstract: Flyweights are small-sized handle classes
granting constant access to shared common data, thus
allowing for the management of large amounts of entities
within reasonable memory limits. Boost.Flyweight makes it
easy to use this common programming idiom by providing the
class template flyweight<T>, which acts as a drop-in
replacement for const T.
* Design: The flyweight library is a relatively
small piece of software that tries to combine both
maximum simplicity of usage for casual users and great
flexibility for those programmers needing to control
aspects of the implementation. Configuration and
customization rely upon a very extensive policy interface,
whose syntax is kept under control thanks to the Boost
The following aspects can be controlled:
- Specification and parameterization of the so-called
- Control of the factory instantiation procedure.
- Specification of the internal synchronization mechanisms.
- Flyweight tracking, allowing for the disposal of stored
values when no longer referenced by any flyweight object.
The library provides a catalog of plug-in components, but
the user can also supply her own as the needed concepts are
In particular, an insidious problem with duplication of
flyweight factories across dynamic modules is taken care
of by a component called intermodule_holder, whose
implementation is based on Boost.Interprocess.
* Download: Boost Vault, folder Patterns
(http://tinyurl.com/hrdm6 ), file flyweight.zip.
* Online docs: http://tinyurl.com/2jbucf .
* Usage: Will only work with the trunk version of Boost,
daily snapshot at http://boost-consulting.com/boost.tar.bz2 .
Currently, serialization capabilities are not working,
pending the resolution of the issue exposed at
* Tested on: GCC 3.4.4 on mingw, MSVC++ 8.0.
Comments, suggestions, cricitisms, are most welcome. I would
also like to know if there's interest in having this
included in the review queue.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk