This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Open status.
Section: 24.3.7 [array] Status: Open Submitter: Bo Persson Opened: 2006-12-30 Last modified: 2022-11-12
View all other issues in [array].
View all issues with Open status.
The <array> header is given under 24.3 [sequences]. 24.3.7 [array]/paragraph 3 says:
"Unless otherwise specified, all array operations are as described in 24.2 [container.requirements]".
However, array isn't mentioned at all in section 24.2 [container.requirements]. In particular, Table 82 "Sequence requirements" lists several operations (insert, erase, clear) that std::array does not have in 24.3.7 [array].
Also, Table 83 "Optional sequence operations" lists several operations that std::array does have, but array isn't mentioned.
[ 2009-07 Frankfurt ]
The real issue seems to be different than what is described here. Non-normative text says that std::array is a sequence container, but there is disagreement about what that really means. There are two possible interpretations:
- a sequence container is one that satisfies all sequence container requirements
- a sequence container is one that satisfies some of the sequence container requirements. Any operation that the container supports is specified by one or more sequence container requirements, unless that operation is specifically singled out and defined alongside the description of the container itself.
Move to Tentatively NAD.
[ 2009-07-15 Loïc Joly adds: ]
The section 24.2.4 [sequence.reqmts]/1 states that array is a sequence. 24.2.4 [sequence.reqmts]/3 introduces table 83, named Sequence container requirements. This seems to me to be defining the requirements for all sequences. However, array does not follow all of this requirements (this can be read in the array specific section, for the standard is currently inconsistent).
Proposed resolution 1 (minimal change):
Say that array is a container, that in addition follows only some of the sequence requirements, as described in the array section:
The library provides
fivebasic kinds of sequence containers: array, vector, forward_list, list, and deque.
Proposed resolution 2 (most descriptive description, no full wording provided):
Introduce the notion of a Fixed Size Sequence, with it requirement table that would be a subset of the current Sequence container. array would be the only Fixed Size Sequence (but dynarray is in the queue for TR2). Sequence requirements would now be requirements in addition to Fixed Size Sequence requirements (it is currently in addition to container).
[ 2009-07 Frankfurt: ]
Move to NAD Editorial
[ 2009 Santa Cruz: ]
This will require a lot of reorganization. Editor doesn't think this is really an issue, since the description of array can be considered as overriding what's specified about sequences. Move to NAD.
[2022-10-27; Hubert Tong comments and requests to reopen]
This issue appears to be unresolved (should not be NAD).As noted in 220.127.116.11 [array.overview] paragraph 3, array does not meet 18.104.22.168 [container.reqmts] paragraph 10. This means that array does not meet the container requirements, never mind the requirements for sequence containers or contiguous containers. However, there is wording that claims the opposite. 24.2.4 [sequence.reqmts] paragraph 1:
In addition, array is provided as a sequence container which provides limited sequence operations because it has a fixed number of elements.
(Perhaps the above should be worded with "except".)24.3.1 [sequences.general] paragraph 1:
The headers <array> […] define class templates that meet the requirements for sequence containers.
22.214.171.124 [array.overview] paragraph 1:
[…] An array is a contiguous container (126.96.36.199 [container.requirements.general]).
In this comment, Casey suggests that the requirements be changed so that array does meet the requirements.
[Kona 2022-11-12; Set Priority to 3]