Design Rationale

There was an important design tradeoff regarding the constructors: if the user implements the array as an "aggregate" (see Section 8.5.1, [dcl.init.aggr], of the C++ Standard). This would mean:

However, this approach has its drawbacks: passing no initializer list means that the elements have an undetermined initial value, because the rule says that aggregates may have:

Nevertheless, The current implementation uses this approach.

Note:For standard conforming compilers it is possible to use fewer braces (according to 8.5.1 (11) of the Standard). That is, initialize an array as follows:

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

The code is provided "as is" without expressed or implied warranty.


Copyright © 2001-2004 Nicolai M. Josuttis