Boost logo

Boost :

From: Andreas Huber (ah2003_at_[hidden])
Date: 2003-04-23 07:02:42


Hi there

I would like to use STL containers in a hard real-time environment. Hard
real-time means that for all operations on the container it is possible to
specify an upper duration limit. At some point containers have to allocate
memory, which is notoriously non-deterministic. The usual solution is to
preallocate for a certain maximum container-size *before* the software needs
to react deterministically.

With std::vector this is easy: Simply call vector::reserve(). However, there
is no such function for all the other standard containers (deque, list, set,
map) and I absolutely need a std::list-like container. The following
solutions come to mind:
- Use a custom allocator
- Write your own list, which provides a reserve() function

Neither is very appealing to me and I can't really believe that there is no
easier solution within the standard library. What am I missing?

Thanks,

Andreas


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