Title
The emplace issue
Status
nad
Section
[container.requirements]
Submitter
Paolo Carlini

Created on 2007-11-11.00:00:00 last changed 118 months ago

Messages

Date: 2015-03-29.13:35:18

Proposed resolution:

Add after [container.requirements]/12:

-12- Objects passed to member functions of a container as rvalue references shall not be elements of that container. No diagnostic required.

-13- Objects bound to the function parameter pack of the emplace member function shall not be elements or sub-objects of elements of the container. No diagnostic required.

Date: 2015-03-29.13:35:18

[ 2015-02 Cologne ]

LWG believes that 2164 addresses this issue and therefore considers 760 as NAD.

Date: 2010-10-21.18:28:33

[ 2009-07 Frankfurt ]

The problem is broader than emplace. The LWG doesn't feel that it knows how to write wording that prohibits all of the problematic use cases at this time.

NAD Future.

Date: 2010-10-21.18:28:33

[ Bellevue: ]

The proposed addition (13) is partially redundant with the existing paragraph 12. Why was the qualifier "rvalues" added to paragraph 12? Why does it not cover subelements and pointers?

Resolution: Alan Talbot to rework language, then set state to Review.

Date: 2014-12-09.20:44:07

[ Related to 767 and to 2164 ]

Date: 2007-11-11.00:00:00

In an emplace member function the function parameter pack may be bound to a priori unlimited number of objects: some or all of them can be elements of the container itself. Apparently, in order to conform to the blanket statement [container.requirements]/11, the implementation must check all of them for that possibility. A possible solution can involve extending the exception in [container.requirements]/12 also to the emplace member. As a side note, the push_back and push_front member functions are luckily not affected by this problem, can be efficiently implemented anyway.

History
Date User Action Args
2015-03-29 13:35:18adminsetmessages: + msg7260
2015-03-29 13:35:18adminsetstatus: open -> nad
2014-11-24 15:11:58adminsetstatus: nad future -> open
2010-10-21 18:28:33adminsetmessages: + msg3682
2010-10-21 18:28:33adminsetmessages: + msg3681
2010-10-21 18:28:33adminsetmessages: + msg3680
2010-10-21 18:28:33adminsetmessages: + msg3679
2007-11-11 00:00:00admincreate