Movatterモバイル変換


[0]ホーム

URL:



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

2039. Issues withstd::reverse andstd::copy_if

Section: 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:

  1. In the description ofstd::reverse

    Effects: For each non-negative integeri <= (last - first)/2, appliesiter_swap to all pairs of iteratorsfirst + i,(last - i) - 1.

    should be changed to

    Effects: For each non-negative integeri< (last - first)/2, appliesiter_swap to all pairs of iteratorsfirst + i,(last - i) - 1.

    Herei shall be strictly less than(last - first)/2.

  2. In the description ofstd::copy_ifReturns paragraph is missing.

[2011-03-02: Daniel drafts wording]

Proposed resolution:

  1. Modify 26.7.10[alg.reverse] p. 1 as indicated:

    1Effects: For each non-negative integeri <= (last - first)/2, appliesiter_swap to all pairs of iteratorsfirst + i,(last - i) - 1.

  2. 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[first,last) and[result,result + (last - first)) shall not overlap.

    9Effects: Copies all of the elements referred to by the iteratori in the range[first,last) for whichpred(*i) is true.

    ??Returns: The end of the resulting range.

    10Complexity: Exactlylast - first applications of the corresponding predicate.

    11Remarks: Stable.


[8]ページ先頭

©2009-2026 Movatter.jp