Last change
on this file since 12 was
12,
checked in by landauf, 17 years ago
|
added boost
|
-
Property svn:executable set to
*
|
File size:
6.5 KB
|
Pointer Container Library
Overview
Boost.Pointer Container provides containers for holding heap-allocated
objects in an exception-safe manner and with minimal overhead.
The aim of the library is in particular to make OO programming
easier in C++ by establishing a standard set of classes, methods
and designs for dealing with OO specific problems
Motivation
Whenever a programmer wants to have a container of pointers to
heap-allocated objects, there is usually only one exception-safe way:
to make a container of pointer pointers like boost::shared_ptr.
This approach is suboptimal if
- the stored objects are not shared, but owned exclusively, or
- the overhead implied by pointer pointers is inappropriate
This library therefore provides standard-like containers that are for storing
heap-allocated or cloned objects (or in case of a map, the mapped object must be
a heap-allocated or cloned object). For each of the standard
containers there is a pointer container equivalent that takes ownership of
the objects in an exception safe manner. In this respect the library is intended
to solve the so-called
polymorphic class problem.
The advantages of pointer containers are
- Exception-safe pointer storage and manipulation.
- Notational convenience compared to the use of containers of pointers.
- Can be used for types that are neither Assignable nor Copy Constructible.
- No memory-overhead as containers of pointer pointers can have (see and ).
- Usually faster than using containers of pointer pointers (see and ).
- The interface is slightly changed towards the domain of pointers
instead of relying on the normal value-based interface. For example,
now it is possible for pop_back() to return the removed element.
- Propagates constness s.t. one cannot modify the objects via a const_iterator
The disadvantages are
- Less flexible than containers of smart pointers like boost::shared_ptr
Acknowledgements
The following people have been very helpful:
- Bjørn D. Rasmussen for unintentionally motivating me to start this library
- Pavel Vozenilek for asking me to make the adapters
- David Abrahams for the indirect_fun design
- Pavol Droba for being review manager
- Ross Boylan for trying out a prototype for real
- Felipe Magno de Almeida for giving fedback based on using the
library in production code even before the library was part of boost
- Jonathan Turkanis for supplying his move_ptr framework
which is used internally
- Stefan Slapeta and Howard Hinnant for Metrowerks support
- Russell Hind for help with Borland compatibility
- Jonathan Wakely for his great help with GCC compatibility and bug fixes
- Pavel Chikulaev for comments and bug-fixes
References
copyright: | Thorsten Ottosen 2004-2005. |
Note: See
TracBrowser
for help on using the repository browser.