Boost logo

Boost :

From: Nicolai Josuttis (nicolai.josuttis_at_[hidden])
Date: 2000-01-03 13:32:50

Darin Adler wrote:
> > He implements the class as POD (making the internal array public),
> > so that the following is possible:
> > carray<int,6> a = { 1, 2, 3, 4, 5, 6 }
> One downside of this is that we then can't define any of the constructors
> that are available for the other container types. For example:
> 1) Default constructor: If there is no constructor and the elements are
> objects that also have POD type, then the elements will be uninitialized
> [8.5/9]. This is like built-in C arrays, but unlike vectors, for example.
> 2) Constructor that takes a single value for the entire container. For a
> vector, you can give an initial value that's used for all the elements as
> in: "std::vector<int> a(6, 23); // 6 elements with the value 23".
> 3) Constructor that takes a pair of iterators. In the case of carray,
> the iterators, there would have to be some decision of what happens when the
> size of the range does not match the size of the carray. We could leave the
> behavior undefined or fill with default-initialized values if the iterator
> range is too small and ignore any extra values if the iterator range is too
> large.
THIS is an important design issue. Unless somebody has a solution to fit
both needs, we have to decide between what I would call an
 - array wrapper and
 - an STL container similar to vector with static size.
Or may be we introduce both.

However, if we introduce both, then we need a name for both
(I' suggest array for the array wrapper and ???vector for the latter).

Opinions, please!

Nicolai M. Josuttis 
Solutions in Time        	mailto:solutions_at_[hidden]

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