Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-02-08 10:08:45

> I have rewritten my fixed_capacity_vector class to solve the second
> problem (construction of non-POD objects).
> I believe that non-POD objects are now constructed and destructed in a
> proper way. As for the alignment problem, however, I'm not sure if
> the current implementation is portable or not.

The implementation is not portable, and potentially wasteful (jeopardizing
the very intent of fixed_vector). I privately emailed you (and Ralf) some
stuff that might be of interest. As you follow, also look up
explanations in

> I will greatly
> appreciate comments and suggestions from all of you on this point.

1. Casting pointers to integers doesn't help much in portable code.

2. Duplicating code to treat PODs and non-PODs is NOT the way to go. Use one
implementation for both. You may want to segregate implementations in a
limited way just for optimization's sake.

I wonder why wouldn't you give it a shot at writing a full-blown vector in
which your storage method is a policy. You're not that far from such an
approach (your fixed_vector_base basically defines your storage policy).

Andrei the manipulative one

Check out THE C++ Seminar: 3 Days with 5 Experts

Boost list run by bdawes at, gregod at, cpdaniel at, john at