Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-01-03 13:53:10

At 07:32 PM 1/3/00 +0100, Nicolai Josuttis wrote:

>Darin Adler wrote:
>> > He implements the class as POD (making the internal array
>> > 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
>> 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
>> [8.5/9]. This is like built-in C arrays, but unlike vectors, for
>> 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
>> 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
>> 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
>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
>Opinions, please!

Ouch! Let's avoid two if we possibly can. Sounds like the problem
needs better definition.


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