Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-08-08 08:34:07


Peter Dimov wrote:
> Johan Råde wrote:
>
>> John Maddock wrote:
>
>>> That one is problematic as it really would make the array a non-POD
>>> so initialisation would occur during the dynamic phase rather than
>>> the static phase.
>
> The compiler is allowed to statically initialize anything it can, and
> in this case VC 7.1 does.

True. Although there are other benefits that POD'ness brings: union
support, pass through elipsis etc. However, since those are less useful, I
might be persuaded that the fix is OK after all if VC7.1 really does the
right thing by static initialisation.

>>> IMO that would be a deal braker :-(
>
> We aren't actually testing static array initialization, are we? How
> do we know that it works at all? :-)

Um, good question. It is very important though.

>> So an array class with a non-template assignment op
>> is an aggregate but is not a POD.
>> This language sometimes drives me nuts ;-)
>
> Non-POD aggregates are common, consider
>
> struct X
> {
> std::string a, b;
> };
>
> X x = { "a", "b" };

Absolutely, and I've used boost::array with non-POD types as well as POD's.
However, the ability to have POD's statically initialised "just like a C
array" is a very useful one.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net