This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

931. type trait extent<T, I>

Section: 21.3.5.4 [meta.unary.prop] Status: C++11 Submitter: Yechezkel Mett Opened: 2008-11-04 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [meta.unary.prop].

View all other issues in [meta.unary.prop].

View all issues with C++11 status.

Discussion:

The draft (N2798) says in 21.3.5.4 [meta.unary.prop] Table 44:

Table 44 -- Type property queries
TemplateValue
template <class T, unsigned I = 0> struct extent; If T is not an array type (8.3.4), or if it has rank less than I, or if I is 0 and T has type "array of unknown bound of U", then 0; otherwise, the size of the I'th dimension of T

Firstly it isn't clear from the wording if I is 0-based or 1-based ("the I'th dimension" sort of implies 1-based). From the following example it is clear that the intent is 0-based, in which case it should say "or if it has rank less than or equal to I".

Sanity check:

The example says assert((extent<int[2], 1>::value) == 0);

Here the rank is 1 and I is 1, but the desired result is 0.

[ Post Summit: ]

Do not use "size" or "value", use "bound". Also, move the cross-reference to 8.3.4 to just after "bound".

Recommend Tentatively Ready.

Proposed resolution:

In Table 44 of 21.3.5.4 [meta.unary.prop], third row, column "Value", change the cell content:

Table 44 -- Type property queries
TemplateValue
template <class T, unsigned I = 0> struct extent; If T is not an array type (8.3.4), or if it has rank less than or equal to I, or if I is 0 and T has type "array of unknown bound of U", then 0; otherwise, the size bound (8.3.4) of the I'th dimension of T, where indexing of I is zero-based.

[ Wording supplied by Daniel. ]