This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
3297. Useless sequence container requirementSection: 23.2.4 [sequence.reqmts] Status: New Submitter: Casey Carter Opened: 2019-09-17 Last modified: 2022-04-24
Priority: 3
View other active issues in [sequence.reqmts].
View all other issues in [sequence.reqmts].
View all issues with New status.
Discussion:
23.2.4 [sequence.reqmts] paragraph 3 says that the names i
and j
denote "iterators that meet the Cpp17InputIterator requirements and refer to elements implicitly convertible to value_type
". Ignoring for the moment that this is an occurrence of LWG 3105(i) — we really mean that *i
and *j
must be implicitly convertible to value_type
— this requirement seems to be completely extraneous.
i
and j
are used in three places in the requirements table:
The range constructors X(i, j)
and X u(i, j)
, which require that the container's value type is Cpp17EmplaceConstructible into the container from *i
; implicit conversion is neither necessary nor sufficient.
The range insert overload a.insert(p, i, j)
which also requires Cpp17EmplaceConstructible, as well as the capability to move elements around for vector
and deque
; again, implicit conversion is neither necessary nor sufficient. It would be useful / performant here to require that the container's value type is assignable from *i
, which may have been the intent of the implicit conversion requirement — would doing so be too breaking?
The range assign overload a.assign(i, j)
which requires both Cpp17EmplaceConstructible as above and that it can assign the result of dereferencing an iterator directly to the container's value type; again, implicit conversion is not useful here.
We should strike the implicit conversion requirement since it is not useful and only serves to confuse readers of the Standard (see e.g. here).
[2019-10-31 Issue Prioritization]
Priority to 3 after reflector discussion.
Previous resolution [SUPERSEDED]:
This wording is relative to N4830.
Modify 23.2.4 [sequence.reqmts] as indicated:
-3- In Tables 76 and 77,
X
denotes a sequence container class,a
denotes a value of typeX
containing elements of typeT
,u
denotes the name of a variable being declared,A
denotesX::allocator_type
if the qualified-idX::allocator_type
is valid and denotes a type (13.10.3 [temp.deduct]) andallocator<T>
if it doesn't,i
andj
denote iterators that meet the Cpp17InputIterator requirements and refer to elements implicitly convertible tovalue_type
,[i, j)
denotes a valid range, […]
[2022-04-24; Daniel rebases wording on N4910]
Proposed resolution:
This wording is relative to N4910.
Modify 23.2.4 [sequence.reqmts] as indicated:
-3- In this subclause,
(3.1) — […]
[…]
(3.5) —
i
andj
denote iterators that meet the Cpp17InputIterator requirements and refer to elements implicitly convertible tovalue_type
,[…]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4