This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
2571. §[map.modifiers]/2 imposes nonsensical requirement oninsert(InputIterator, InputIterator)
Section: 23.4.3.4 [map.modifiers] Status: C++17 Submitter: Tim Song Opened: 2015-12-12 Last modified: 2017-07-30
Priority: 0
View all other issues in [map.modifiers].
View all issues with C++17 status.
Discussion:
The initial paragraphs of 23.4.3.4 [map.modifiers] currently read:
template <class P> pair<iterator, bool> insert(P&& x); template <class P> iterator insert(const_iterator position, P&& x); template <class InputIterator> void insert(InputIterator first, InputIterator last);-1- Effects: The first form is equivalent to
-2- Remarks: These signatures shall not participate in overload resolution unlessreturn emplace(std::forward<P>(x))
. The second form is equivalent toreturn emplace_hint(position, std::forward<P>(x))
.std::is_constructible<value_type, P&&>::value
istrue
.
Clearly, p2's requirement makes no sense for insert(InputIterator, InputIterator)
- it doesn't even have a template parameter called P
.
InputIterator
parameters does not require CopyConstructible
of either key_type
or mapped_type
if the dereferenced InputIterator
returns a non-const
rvalue pair<key_type,mapped_type>
. Otherwise CopyConstructible
is required for both key_type
and mapped_type
", but that was removed by LWG 2005(i), whose PR was written as if that overload didn't exist in the text. It looks like the text addressing this overload is redundant to the requirements on a.insert(i, j)
in Table 102 that value_type
be EmplaceConstructible
from *i
. If so, then the signature should just be deleted from this section.
[2016-02, Issues Telecon]
P0; move to Tentatively Ready.
Proposed resolution:
This wording is relative to N4567.
Edit 23.4.3.4 [map.modifiers] as indicated:
template <class P> pair<iterator, bool> insert(P&& x); template <class P> iterator insert(const_iterator position, P&& x); template <class InputIterator> void insert(InputIterator first, InputIterator last);-1- Effects: The first form is equivalent to
-2- Remarks: These signatures shall not participate in overload resolution unlessreturn emplace(std::forward<P>(x))
. The second form is equivalent toreturn emplace_hint(position, std::forward<P>(x))
.std::is_constructible<value_type, P&&>::value
istrue
.
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