|
Boost : |
From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-05-31 16:15:19
"Jonathan Turkanis" <technews_at_[hidden]> wrote in message
news:d7iigr$7tn$1_at_sea.gmane.org...
> 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.
It would indicate that the array was not yet initialized and could help
prevent erroneous use of uninitialized arrays. This behaviour is in fact
implied by the fact that there exists an empty() function and separate
size() and max_size() functions. The documentation IMO contradicts the
intuitive interepretation of the class declaration.
> 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.
If operator=(T x) was defined then we could instead have the significantly
better:
boost::array<int, 2> ar;
ar = 1, 2, 3;
-- Christopher Diggins http://www.cdiggins.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk