617. std::array is a sequence that doesn't satisfy the sequence requirements?

Section: 26.3.7 [array] Status: NAD Submitter: Bo Persson Opened: 2006-12-30 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [array].

View all issues with NAD status.

Discussion:

The <array> header is given under 26.3 [sequences]. 26.3.7 [array]/paragraph 3 says:

"Unless otherwise specified, all array operations are as described in 26.2 [container.requirements]".

However, array isn't mentioned at all in section 26.2 [container.requirements]. In particular, Table 82 "Sequence requirements" lists several operations (insert, erase, clear) that std::array does not have in 26.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:

  1. a sequence container is one that satisfies all sequence container requirements
  2. 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 26.2.3 [sequence.reqmts]/1 states that array is a sequence. 26.2.3 [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 five three 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: ]

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.

Proposed resolution: