1 <section id=
"array.rationale">
2 <title>Design Rationale
</title>
5 There was an important design tradeoff regarding the
6 constructors: We could implement array as an
"aggregate" (see
7 Section
8.5.1, [dcl.init.aggr], of the C++ Standard). This would
12 An array can be initialized with a
13 brace-enclosing, comma-separated list of initializers for the
14 elements of the container, written in increasing subscript
19 <classname>boost::array
</classname><int,
4> a = { {
1,
2,
3 } };
23 Note that if there are fewer elements in the
24 initializer list, then each remaining element gets
25 default-initialized (thus, it has a defined value).
32 However, this approach has its drawbacks:
<emphasis
34 passing no initializer list means that the elements
35 have an indetermined initial value
36 </emphasis>, because the rule says
37 that aggregates may have:
40 <simpara>No user-declared constructors.
</simpara>
43 <simpara>No private or protected non-static data members.
</simpara>
46 <simpara>No base classes.
</simpara>
49 <simpara>No virtual functions.
</simpara>
54 <para>Nevertheless, The current implementation uses this approach.
</para>
57 Note that for standard conforming compilers it is possible to
58 use fewer braces (according to
8.5.1 (
11) of the Standard). That is,
59 you can initialize an array as follows:
63 <classname>boost::array
</classname><int,
4> a = {
1,
2,
3 };
67 I'd appreciate any constructive feedback.
<emphasis
69 Please note: I don't have time to read all boost
70 mails. Thus, to make sure that feedback arrives to me, please send
71 me a copy of each mail regarding this class.
76 The code is provided
"as is" without expressed or implied