3552. Parallel specialized memory algorithms should require forward iterators

Section: 20.2.2 [memory.syn] Status: C++23 Submitter: Tim Song Opened: 2021-05-16 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [memory.syn].

View all issues with C++23 status.

Discussion:

The parallel versions of uninitialized_{copy,move}{,_n} are currently depicted as accepting input iterators for their source range. Similar to the non-uninitialized versions, they should require the source range to be at least forward.

[2021-05-20; Reflector poll]

Set status to Tentatively Ready after six votes in favour during reflector poll.

[2021-06-07 Approved at June 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4885.

  1. Modify 20.2.2 [memory.syn], header <memory> synopsis, as indicated:

      […]
    namespace std {
      […]
    
      template<class InputIterator, class NoThrowForwardIterator>
        NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
                                                  NoThrowForwardIterator result);
      template<class ExecutionPolicy, class InputForwardIterator, class NoThrowForwardIterator>
        NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see 26.3.5 [algorithms.parallel.overloads]
                                                  InputForwardIterator first, InputForwardIterator last,
                                                  NoThrowForwardIterator result);
      template<class InputIterator, class Size, class NoThrowForwardIterator>
        NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n,
                                                    NoThrowForwardIterator result);
      template<class ExecutionPolicy, class InputForwardIterator, class Size, class NoThrowForwardIterator>
        NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see 26.3.5 [algorithms.parallel.overloads]
                                                    InputForwardIterator first, Size n,
                                                    NoThrowForwardIterator result);  
      […]
    
      template<class InputIterator, class NoThrowForwardIterator>
        NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last,
                                                  NoThrowForwardIterator result);
      template<class ExecutionPolicy, class InputForwardIterator, class NoThrowForwardIterator>
        NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see 26.3.5 [algorithms.parallel.overloads]
                                                  InputForwardIterator first, InputForwardIterator last,
                                                  NoThrowForwardIterator result);
      template<class InputIterator, class Size, class NoThrowForwardIterator>
        pair<InputIterator, NoThrowForwardIterator>
          uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);
      template<class ExecutionPolicy, class InputForwardIterator, class Size, class NoThrowForwardIterator>
        pair<InputForwardIterator, NoThrowForwardIterator>
          uninitialized_move_n(ExecutionPolicy&& exec, // see 26.3.5 [algorithms.parallel.overloads]
                               InputForwardIterator first, Size n, NoThrowForwardIterator result);
    
      […]
    }