5

Is it guaranteed that sizeof (std::array<T, N>) == N * sizeof (T)?

Please provide support from the C++ Standard.

There's a related question about std::tr1::array.


To get you started:

std::array IS an aggregate. If T is POD, so is std::array<T, N>. That makes it also standard-layout.

There ought to be some Standard reference connecting that to a prohibition on padding (padding for alignment would be allowed, but array length is a multiple of its alignment already).

Community
  • 1
  • 1
Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • 2
    http://stackoverflow.com/questions/19103244/is-the-size-of-stdarray-defined-by-standard – mclaassen Jun 20 '14 at 00:42
  • @mclaassen: Indeed... and that didn't come up in a search for `[c++] sizeof std::array`. So best to make this into a pointer to the other (via duplicate closure). – Ben Voigt Jun 20 '14 at 00:56

0 Answers0