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.
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 Template Value template <class T, unsigned I = 0> struct extent;
If T
is not an array type (8.3.4), or if it has rank less thanI
, or ifI
is 0 andT
has type "array of unknown bound ofU
", then 0; otherwise, the size of theI
'th dimension ofT
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 Template Value 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 toI
, or ifI
is 0 andT
has type "array of unknown bound ofU
", then 0; otherwise, thesizebound (8.3.4) of theI
'th dimension ofT
, where indexing ofI
is zero-based.
[ Wording supplied by Daniel. ]