Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
array/std::array/boost::array is one of these topics:

A plain array

std::tr1::array

boost::array

std::array
See array/std::array/boost::array example 1: comparison for a comparison.

A plain array
An array is a collection of elements that can be accessed by
the index operator.
int myArray[10]; //Create an array that stores ten integers
|
Prefer a std::vector (or perhaps std::array) over an array by default [1-4]. Consider not using
arrays in the interface of a class.
The first element of an array is at index zero.
There are two kinds of arrays:
- Static arrays: size known at compile-time, for example 'int v[10]'
- Dynamically allocated arrays: size gets determined at run-time, for example 'int * v')
Take care not to write beyond the bounds of an array [5].

boost::array
See array/std::array/boost::array example 1: comparison for a comparison.

std::array
See array/std::array/boost::array example 1: comparison for a comparison.
- Bjarne Stroustrup. The C++ Programming Language (3rd edition). ISBN: 0-201-88954-4 Chapter 5.8.4 'Use vector and valarray rather than built-in (C-style) arrays'
- Herb Sutter and Andrei Alexandrescu . C++ coding standards: 101 rules, guidelines, and best practices. ISBN: 0-32-111358-6. Chapter 76: 'Use vector by default. Otherwise choose an appropriate container'
- Marshall Cline, Greg Lomow and Mike Girou. C++ FAQs. ISBN: 0-201-3098301, FAQ 28.02: 'Are arrays good or evil?' (Answer: 'Arrays are evil'
- Bjarne Stroustrup. The C++ Programming Language (3rd edition). ISBN: 0-201-88954-4 Chapter C.14.11 'Prefer vector over array'
- Bjarne Stroustrup. The C++ Programming Language (3rd edition). ISBN: 0-201-88954-4 5.8.2: 'Take care not to write beyond the bounds of an array'
- Joint Strike Fighter Air Vehicle C++ Coding Standards for the System Development and Demonstration Program. Document Number 2RDU00001 Rev C. December 2005. AV Rule 97: 'Arrays shall not be used in interfaces. Instead, the Array class should be used.'
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.
