Boost logo

Boost :

From: Sean Parent (sparent_at_[hidden])
Date: 2002-02-05 14:55:53


I've had stl-like containers for auto_ptr types that I've been using for
years - but I _don't_ think they should be submitted to boost. I've come to
the realization that what you _really_ want is to design a container set for
types that can meet a different set of requirements:

1. The type need not provide assignment, copy construction, or default
construction.
2. The type must provide a non-throwing swap.

The resulting containers (vector, map, set, deque...) would all have
transactional semantics (if an insert into the middle fails, the source and
destinations are left in their original state). This is fairly easy to
manage "rolling" items into place (and results in a more efficient container
than the current ones).

As an optimization, a non-throwing move specialization can be provided (the
default is defined in terms of swap). Move requires that after the move the
source be left in a destructable but inderterminate state. auto_ptr
assignment qualifies as a move operation (as does scaler assignment). One
_big_ feature request I have for C++0x is parameterized destruction so that
move can be implemented more efficiently.

These containers can't be built as adaptors on top of the current
containers - there is no way to meet these requirements.

But if we build these (they aren't that difficult) - you end up with a set
of containers that are higher performance, have better exception behavior,
and work with auto_ types and other non-copyable types.

Sean Parent


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk