From Jason Turner

[transform.inclusive.scan]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1e55a41u/{from.md → to.md} +26 -23
tmp/tmp1e55a41u/{from.md → to.md} RENAMED
@@ -1,56 +1,59 @@
1
  ### Transform inclusive scan <a id="transform.inclusive.scan">[[transform.inclusive.scan]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator, class OutputIterator,
5
  class BinaryOperation, class UnaryOperation>
6
- OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
 
7
  OutputIterator result,
8
- BinaryOperation binary_op,
9
- UnaryOperation unary_op);
10
  template<class ExecutionPolicy,
11
  class ForwardIterator1, class ForwardIterator2,
12
  class BinaryOperation, class UnaryOperation>
13
- ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec,
 
14
  ForwardIterator1 first, ForwardIterator1 last,
15
  ForwardIterator2 result,
16
- BinaryOperation binary_op,
17
- UnaryOperation unary_op);
18
  template<class InputIterator, class OutputIterator,
19
  class BinaryOperation, class UnaryOperation, class T>
20
- OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
 
21
  OutputIterator result,
22
- BinaryOperation binary_op,
23
- UnaryOperation unary_op,
24
  T init);
25
  template<class ExecutionPolicy,
26
  class ForwardIterator1, class ForwardIterator2,
27
  class BinaryOperation, class UnaryOperation, class T>
28
- ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec,
 
29
  ForwardIterator1 first, ForwardIterator1 last,
30
  ForwardIterator2 result,
31
- BinaryOperation binary_op,
32
- UnaryOperation unary_op,
33
  T init);
34
  ```
35
 
36
- *Requires:*
 
 
37
 
38
- - If `init` is provided, `T` shall be `MoveConstructible`
39
- (Table  [[tab:moveconstructible]]); otherwise, `ForwardIterator1`’s
40
- value type shall be `MoveConstructible`.
41
- - If `init` is provided, all of
42
  - `binary_op(init, init)`,
43
  - `binary_op(init, unary_op(*first))`, and
44
  - `binary_op(unary_op(*first), unary_op(*first))`
45
 
46
- shall be convertible to `T`; otherwise,
47
- `binary_op(unary_op(*first), unary_op(*first))` shall be convertible
48
- to `ForwardIterator1`’s value type.
49
- - Neither `unary_op` nor `binary_op` shall invalidate iterators or
50
- subranges, nor modify elements in the ranges \[`first`, `last`\] or
51
- \[`result`, `result + (last - first)`\].
 
 
 
 
 
52
 
53
  *Effects:* For each integer `K` in \[`0`, `last - first`) assigns
54
  through `result + K` the value of
55
 
56
  - *GENERALIZED_NONCOMMUTATIVE_SUM*(
 
1
  ### Transform inclusive scan <a id="transform.inclusive.scan">[[transform.inclusive.scan]]</a>
2
 
3
  ``` cpp
4
  template<class InputIterator, class OutputIterator,
5
  class BinaryOperation, class UnaryOperation>
6
+ constexpr OutputIterator
7
+ transform_inclusive_scan(InputIterator first, InputIterator last,
8
  OutputIterator result,
9
+ BinaryOperation binary_op, UnaryOperation unary_op);
 
10
  template<class ExecutionPolicy,
11
  class ForwardIterator1, class ForwardIterator2,
12
  class BinaryOperation, class UnaryOperation>
13
+ ForwardIterator2
14
+ transform_inclusive_scan(ExecutionPolicy&& exec,
15
  ForwardIterator1 first, ForwardIterator1 last,
16
  ForwardIterator2 result,
17
+ BinaryOperation binary_op, UnaryOperation unary_op);
 
18
  template<class InputIterator, class OutputIterator,
19
  class BinaryOperation, class UnaryOperation, class T>
20
+ constexpr OutputIterator
21
+ transform_inclusive_scan(InputIterator first, InputIterator last,
22
  OutputIterator result,
23
+ BinaryOperation binary_op, UnaryOperation unary_op,
 
24
  T init);
25
  template<class ExecutionPolicy,
26
  class ForwardIterator1, class ForwardIterator2,
27
  class BinaryOperation, class UnaryOperation, class T>
28
+ ForwardIterator2
29
+ transform_inclusive_scan(ExecutionPolicy&& exec,
30
  ForwardIterator1 first, ForwardIterator1 last,
31
  ForwardIterator2 result,
32
+ BinaryOperation binary_op, UnaryOperation unary_op,
 
33
  T init);
34
  ```
35
 
36
+ Let `U` be the value type of `decltype(first)`.
37
+
38
+ *Mandates:* If `init` is provided, all of
39
 
 
 
 
 
40
  - `binary_op(init, init)`,
41
  - `binary_op(init, unary_op(*first))`, and
42
  - `binary_op(unary_op(*first), unary_op(*first))`
43
 
44
+ are convertible to `T`; otherwise,
45
+ `binary_op(unary_op(*first), unary_op(*first))` is convertible to `U`.
46
+
47
+ *Preconditions:*
48
+
49
+ - If `init` is provided, `T` meets the *Cpp17MoveConstructible*
50
+ ([[cpp17.moveconstructible]]) requirements; otherwise, `U` meets the
51
+ *Cpp17MoveConstructible* requirements.
52
+ - Neither `unary_op` nor `binary_op` invalidates iterators or subranges,
53
+ nor modifies elements in the ranges \[`first`, `last`\] or \[`result`,
54
+ `result + (last - first)`\].
55
 
56
  *Effects:* For each integer `K` in \[`0`, `last - first`) assigns
57
  through `result + K` the value of
58
 
59
  - *GENERALIZED_NONCOMMUTATIVE_SUM*(