...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
There was an important design tradeoff regarding the constructors: We could implement array as an "aggregate" (see Section 8.5.1, [dcl.init.aggr], of the C++ Standard). This would mean:
An array can be initialized with a brace-enclosing, comma-separated list of initializers for the elements of the container, written in increasing subscript order:
boost::array<int,4> a = { { 1, 2, 3 } };
Note that if there are fewer elements in the initializer list, then each remaining element gets default-initialized (thus, it has a defined value). However, passing no initializer list means that the elements have an indetermined initial value.
The current implementation uses this approach. However, being able to have indeterminate initial values is a big drawback. So, please give me some feedback, how useful you consider this feature to be.
Last revised: , at GMT | Copyright © 2001 Nicolai M. Josuttis |