Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-05-31 15:49:40


christopher diggins wrote:
> ----- Original Message -----
> From: "Jonathan Turkanis" <technews_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Tuesday, May 31, 2005 3:37 PM
> Subject: [boost] Re: Boost Array Initialization Technique
>
>
>> christopher diggins wrote:
>>> The fact that the Boost array class does not support constructors in
>>> favour of the limited and somewhat obscure aggregate initialization
>>> syntax has me concerned. IMO it would be much more flexible and
>>> powerful to support overloading of the comma operator. The following
>>> works on Visual C++
>>
>> <snip>
>>
>>> This is much more flexible and it allows us to have constructors in
>>> boost::array thus making it a full reversible container.
>>
>> Are you saying you want boost::array to satisfy the requirements in
>> Table 65?
>>
>> I think the postconditions for the expressions "X u" and "X()" will
>> be hard to
>> achieve. ;-)
>
> Not if the semantics were changed so that size() returned 0 when the
> array was unitialized (which I think would be an improvement).

boost::array is just supposed to give built-in arrays a container interface.
Built-in arrays never have size 0, so I don't see why boost::arrays should.

> But
> fine, let's say that won't happen until heck freezes over, do you
> have an opinion on the
> fact that boost array has no constructors simply to support the rather
> obscure syntax of:
>
> boost::array a = { { 1, 2, 3; } } // notice two sets of { }

compare:

     boost::array<int, 2> ar = { { 1, 2, 3 } };

with

    boost::array<int, 2> ar;
    initialize(ar) = 1, 2, 3;

I like the first one.

> Christopher Diggins

Jonathan


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