Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Design Rationale

Design Rationale

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.

  • It has no user-declared constructors.
  • It has no private or protected non-static data members.
  • It has no base classes.
  • It has no virtual functions.

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 GMTCopyright © 2001 Nicolai M. Josuttis