Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.

538. 241 again: Does unique_copy() require CopyConstructible and Assignable?

Section: 26.7.9[alg.unique]Status:CD1Submitter: Howard HinnantOpened: 2006-02-09Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [alg.unique].

View all issues withCD1 status.

Discussion:

I believe I botched the resolution of241(i)"Does unique_copy() require CopyConstructible and Assignable?" which nowhas WP status.

This talks aboutunique_copy requirements and currently reads:

-5-Requires: The ranges[first,last) and[result,result+(last-first))shall not overlap. The expression*result = *first shallbe valid. If neitherInputIterator norOutputIterator meets therequirements of forward iterator then the value type ofInputIteratormust be CopyConstructible (20.1.3). Otherwise CopyConstructible is not required.

The problem (which Paolo discovered) is that when the iterators are at theirmost restrictive (InputIterator,OutputIterator), then we wantInputIterator::value_type to be bothCopyConstructible andCopyAssignable (for the most efficient implementation). However thisproposed resolution only makes it clear that it isCopyConstructible,and that one can assign from*first to*result.This latter requirement does not necessarily imply that you can:

*first = *first;

Proposed resolution:

-5-Requires: The ranges[first,last) and[result,result+(last-first))shall not overlap. The expression*result = *firstshallbe valid. If neitherInputIterator norOutputIterator meets therequirements of forward iterator then thevalue typevalue_type ofInputIteratormust be CopyConstructible (20.1.3)and Assignable.Otherwise CopyConstructible is not required.


[8]ページ先頭

©2009-2026 Movatter.jp