Title
241 again: Does unique_copy() require CopyConstructible and Assignable?
Status
cd1
Section
[alg.unique]
Submitter
Howard Hinnant

Created on 2006-02-09.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

-5- Requires: The ranges [first, last) and [result, result+(last-first)) shall not overlap. The expression *result = *first shall be valid. If neither InputIterator nor OutputIterator meets the requirements of forward iterator then the value type value_type of InputIterator must be CopyConstructible (20.1.3) and Assignable. Otherwise CopyConstructible is not required.

Date: 2006-02-09.00:00:00

I believe I botched the resolution of 241 "Does unique_copy() require CopyConstructible and Assignable?" which now has WP status.

This talks about unique_copy requirements and currently reads:

-5- Requires: The ranges [first, last) and [result, result+(last-first)) shall not overlap. The expression *result = *first shall be valid. If neither InputIterator nor OutputIterator meets the requirements of forward iterator then the value type of InputIterator must be CopyConstructible (20.1.3). Otherwise CopyConstructible is not required.

The problem (which Paolo discovered) is that when the iterators are at their most restrictive (InputIterator, OutputIterator), then we want InputIterator::value_type to be both CopyConstructible and CopyAssignable (for the most efficient implementation). However this proposed resolution only makes it clear that it is CopyConstructible, and that one can assign from *first to *result. This latter requirement does not necessarily imply that you can:

*first = *first;
History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2990
2006-02-09 00:00:00admincreate