Title
Issues with std::reverse and std::copy_if
Status
c++14
Section
[alg.copy] [alg.reverse]
Submitter
Nikolay Ivchenkov

Created on 2011-03-02.00:00:00 last changed 123 months ago

Messages

Date: 2011-03-02.23:24:12

Proposed resolution:

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

    1 Effects: For each non-negative integer i <= (last - first)/2, applies iter_swap to all pairs of iterators first + i, (last - i) - 1.

  2. Add the following Returns element after [alg.copy] p. 9:

    template<class InputIterator, class OutputIterator, class Predicate>
    OutputIterator copy_if(InputIterator first, InputIterator last,
       OutputIterator result, Predicate pred);
    

    8 Requires: The ranges [first,last) and [result,result + (last - first)) shall not overlap.

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

    ?? Returns: The end of the resulting range.

    10 Complexity: Exactly last - first applications of the corresponding predicate.

    11 Remarks: Stable.

Date: 2011-03-02.00:00:00

[ 2011-03-02: Daniel drafts wording ]

Date: 2011-03-02.00:00:00
  1. In the description of std::reverse

    Effects: For each non-negative integer i <= (last - first)/2, applies iter_swap to all pairs of iterators first + i, (last - i) - 1.

    should be changed to

    Effects: For each non-negative integer i < (last - first)/2, applies iter_swap to all pairs of iterators first + i, (last - i) - 1.

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

  2. In the description of std::copy_if Returns paragraph is missing.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2012-02-12 18:36:43adminsetstatus: voting -> wp
2012-02-09 04:07:48adminsetstatus: ready -> voting
2011-09-06 13:05:28adminsetstatus: voting -> ready
2011-08-16 10:45:53adminsetstatus: ready -> voting
2011-03-24 15:58:06adminsetstatus: new -> ready
2011-03-02 23:24:12adminsetmessages: + msg5575
2011-03-02 23:24:12adminsetmessages: + msg5574
2011-03-02 00:00:00admincreate