Title
Superfluous requirements for replace algorithms
Status
nad concepts
Section
[alg.replace]
Submitter
Daniel Krügler

Created on 2008-10-03.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. Remove [alg.replace]/1.

    template<ForwardIterator Iter, class T> 
      requires OutputIterator<Iter, Iter::reference> 
            && OutputIterator<Iter, const T&> 
            && HasEqualTo<Iter::value_type, T> 
      void replace(Iter first, Iter last, 
                   const T& old_value, const T& new_value); 
    
    template<ForwardIterator Iter, Predicate<auto, Iter::value_type> Pred, class T> 
      requires OutputIterator<Iter, Iter::reference> 
            && OutputIterator<Iter, const T&> 
            && CopyConstructible<Pred> 
      void replace_if(Iter first, Iter last, 
                      Pred pred, const T& new_value);
    

    1 Requires: The expression *first = new_value shall be valid.

  2. [alg.replace]/4: Remove the sentence "The results of the expressions *first and new_value shall be writable to the result output iterator.".

    template<InputIterator InIter, typename OutIter, class T> 
      requires OutputIterator<OutIter, InIter::reference> 
            && OutputIterator<OutIter, const T&> 
            && HasEqualTo<InIter::value_type, T> 
      OutIter replace_copy(InIter first, InIter last, 
                           OutIter result, 
                           const T& old_value, const T& new_value);
    
    template<InputIterator InIter, typename OutIter,
             Predicate<auto, InIter::value_type> Pred, class T> 
      requires OutputIterator<OutIter, InIter::reference> 
            && OutputIterator<OutIter, const T&> 
            && CopyConstructible<Pred> 
      OutIter replace_copy_if(InIter first, InIter last, 
                              OutIter result, 
                              Pred pred, const T& new_value);
    

    4 Requires: The results of the expressions *first and new_value shall be writable to the result output iterator. The ranges [first,last) and [result,result + (last - first)) shall not overlap.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We agree with the proposed resolution.

Move to Tentatively Ready.

Date: 2008-10-03.00:00:00

(A) [alg.replace]/1:

Requires: The expression *first = new_value shall be valid.

(B) [alg.replace]/4:

Requires: The results of the expressions *first and new_value shall be writable to the result output iterator.[..]

Since conceptualization, the quoted content of these clauses is covered by the existing requirements

(A) OutputIterator<Iter, const T&>

and

(B) OutputIterator<OutIter, InIter::reference> && OutputIterator<OutIter, const T&>

resp, and thus should be removed.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4335
2010-10-21 18:28:33adminsetmessages: + msg4334
2008-10-03 00:00:00admincreate