This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++14 status.
std::reverse andstd::copy_ifSection: 26.7.1[alg.copy], 26.7.10[alg.reverse]Status:C++14Submitter: Nikolay IvchenkovOpened: 2011-03-02Last modified: 2016-01-28
Priority:Not Prioritized
View otheractive issues in [alg.copy].
View all otherissues in [alg.copy].
View all issues withC++14 status.
Discussion:
In the description ofstd::reverse
Effects: For each non-negative integer
i <= (last - first)/2, appliesiter_swapto all pairs of iteratorsfirst + i,(last - i) - 1.
should be changed to
Effects: For each non-negative integer
i< (last - first)/2, appliesiter_swapto all pairs of iteratorsfirst + i,(last - i) - 1.
Herei shall be strictly less than(last - first)/2.
In the description ofstd::copy_ifReturns paragraph is missing.
[2011-03-02: Daniel drafts wording]
Proposed resolution:
Modify 26.7.10[alg.reverse] p. 1 as indicated:
1Effects: For each non-negative integer
i <, applies=(last - first)/2iter_swapto all pairs of iteratorsfirst + i,(last - i) - 1.
Add the followingReturns element after 26.7.1[alg.copy] p. 9:
template<class InputIterator, class OutputIterator, class Predicate>OutputIterator copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);8Requires: The ranges
9Effects: Copies all of the elements referred to by the iterator[first,last)and[result,result + (last - first))shall not overlap.iin the range[first,last)for whichpred(*i)is true.??Returns: The end of the resulting range.10Complexity: Exactlylast - firstapplications of the corresponding predicate.11Remarks: Stable.