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++17 status.

2689. Parallel versions ofstd::copy andstd::move shouldn't be in order

Section: 26.7.1[alg.copy], 26.7.2[alg.move]Status:C++17Submitter: Tim SongOpened: 2016-03-23Last modified: 2017-07-30

Priority:0

View otheractive issues in [alg.copy].

View all otherissues in [alg.copy].

View all issues withC++17 status.

Discussion:

26.3.5[algorithms.parallel.overloads]/2 says that "Unless otherwise specified, the semantics ofExecutionPolicy algorithm overloads are identical to their overloads without."

There's no "otherwise specified" for theExecutionPolicy overloads forstd::copy andstd::move, so the requirement that they "start[] from first and proceed[] to last" in the original algorithm's description would seem to apply, which defeats the whole point of adding a parallel overload.

[2016-05 Issues Telecon]

Marshall noted that all three versions of copy have subtly different wording, and suggested that they should not.

Proposed resolution:

This wording is relative to N4582.

  1. Insert the following paragraphs after 26.7.1[alg.copy]/4:

    template<class ExecutionPolicy, class InputIterator, class OutputIterator>  OutputIterator copy(ExecutionPolicy&& policy, InputIterator first, InputIterator last,                      OutputIterator result);

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

    -?-Effects: Copies elements in the range[first, last) into the range[result, result + (last -first)). For each non-negative integern < (last - first), performs*(result + n) = *(first + n).

    -?-Returns:result + (last - first).

    -?-Complexity: Exactlylast - first assignments.

  2. Insert the following paragraphs after 26.7.2[alg.move]/4:

    template<class ExecutionPolicy, class InputIterator, class OutputIterator>  OutputIterator move(ExecutionPolicy&& policy, InputIterator first, InputIterator last,                      OutputIterator result);

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

    -?-Effects: Moves elements in the range[first, last) into the range[result, result + (last -first)). For each non-negative integern < (last - first), performs*(result + n) = std::move(*(first + n)).

    -?-Returns:result + (last - first).

    -?-Complexity: Exactlylast - first assignments.


[8]ページ先頭

©2009-2026 Movatter.jp