Created on 2006-12-30.00:00:00 last changed 25 months ago
[ Kona 2022-11-12; Set Priority to 3 ]
[ 2022-10-27; Hubert Tong comments and requests to reopen ]
This issue appears to be unresolved (should not be NAD).
As noted in [array.overview] paragraph 3, array does not meet [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. [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".)
[sequences.general] paragraph 1:The headers <array> […] define class templates that meet the requirements for sequence containers.
[array.overview] paragraph 1:
[…] An array is a contiguous container ([container.requirements.general]).
In this comment, Casey suggests that the requirements be changed so that array does meet the requirements.
[ 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.
[ 2009-07 Frankfurt: ]
Move to NAD Editorial
[ 2009-07-15 Loïc Joly adds: ]
The section [sequence.reqmts]/1 states that array is a sequence. [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
fivethree basic kinds of sequence containers:array, vector,forward_list, list, and deque. In addition, array and forward_list follows some of the requirements of sequences, as described in their respective sections.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 ]
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.
The <array> header is given under [sequences]. [array]/paragraph 3 says:
"Unless otherwise specified, all array operations are as described in [container.requirements]".
However, array isn't mentioned at all in section [container.requirements]. In particular, Table 82 "Sequence requirements" lists several operations (insert, erase, clear) that std::array does not have in [array].
Also, Table 83 "Optional sequence operations" lists several operations that std::array does have, but array isn't mentioned.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-11-12 01:08:30 | admin | set | messages: + msg13033 |
2022-10-29 12:17:14 | admin | set | messages: + msg12897 |
2022-10-29 12:17:14 | admin | set | status: nad -> open |
2010-10-21 18:28:33 | admin | set | messages: + msg3231 |
2010-10-21 18:28:33 | admin | set | messages: + msg3230 |
2010-10-21 18:28:33 | admin | set | messages: + msg3229 |
2010-10-21 18:28:33 | admin | set | messages: + msg3228 |
2006-12-30 00:00:00 | admin | create |