Assume we have an array that contains N elements of type T.
T a[N];
According to the C++14 Standard, under which conditions do we
In [dcl.array]:
An object of array type contains a contiguously allocated non-empty set of
Nsubobjects of typeT.
Contiguous implies that the offset between any consecutive subobjects of type T is sizeof(T), which implies that the offset of the nth subobject is n*sizeof(T).
The upper bound of n < N comes from [expr.add]:
When an expression that has integral type is added to or subtracted from a pointer, the result has the type of the pointer operand. If the expression
Ppoints to elementx[i]of an array objectxwithnelements, the expressionsP + JandJ + P(whereJhas the valuej) point to the (possibly-hypothetical) elementx[i + j]if0 <= i + j < n; otherwise, the behavior is undefined.