From Jason Turner

[range.adaptor.object]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpg38usk4a/{from.md → to.md} +60 -19
tmp/tmpg38usk4a/{from.md → to.md} RENAMED
@@ -1,40 +1,81 @@
1
  ### Range adaptor objects <a id="range.adaptor.object">[[range.adaptor.object]]</a>
2
 
3
  A *range adaptor closure object* is a unary function object that accepts
4
- a `viewable_range` argument and returns a `view`. For a range adaptor
5
- closure object `C` and an expression `R` such that `decltype((R))`
6
- models `viewable_range`, the following expressions are equivalent and
7
- yield a `view`:
8
 
9
  ``` cpp
10
  C(R)
11
  R | C
12
  ```
13
 
14
  Given an additional range adaptor closure object `D`, the expression
15
- `C | D` is well-formed and produces another range adaptor closure object
16
- such that the following two expressions are equivalent:
 
17
 
18
- ``` cpp
19
- R | C | D
20
- R | (C | D)
21
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  A *range adaptor object* is a customization point object
24
  [[customization.point.object]] that accepts a `viewable_range` as its
25
- first argument and returns a `view`.
26
 
27
  If a range adaptor object accepts only one argument, then it is a range
28
  adaptor closure object.
29
 
30
- If a range adaptor object accepts more than one argument, then the
31
- following expressions are equivalent:
 
 
 
 
 
 
 
32
 
33
- ``` cpp
34
- adaptor(range, args...)
35
- adaptor(args...)(range)
36
- range | adaptor(args...)
37
- ```
 
38
 
39
- In this case, `adaptor(args...)` is a range adaptor closure object.
 
 
40
 
 
1
  ### Range adaptor objects <a id="range.adaptor.object">[[range.adaptor.object]]</a>
2
 
3
  A *range adaptor closure object* is a unary function object that accepts
4
+ a range argument. For a range adaptor closure object `C` and an
5
+ expression `R` such that `decltype((R))` models `range`, the following
6
+ expressions are equivalent:
 
7
 
8
  ``` cpp
9
  C(R)
10
  R | C
11
  ```
12
 
13
  Given an additional range adaptor closure object `D`, the expression
14
+ `C | D` produces another range adaptor closure object `E`. `E` is a
15
+ perfect forwarding call wrapper [[term.perfect.forwarding.call.wrapper]]
16
+ with the following properties:
17
 
18
+ - Its target object is an object `d` of type `decay_t<decltype((D))>`
19
+ direct-non-list-initialized with `D`.
20
+ - It has one bound argument entity, an object `c` of type
21
+ `decay_t<decltype((C))>` direct-non-list-initialized with `C`.
22
+ - Its call pattern is `d(c(arg))`, where `arg` is the argument used in a
23
+ function call expression of `E`.
24
+
25
+ The expression `C | D` is well-formed if and only if the initializations
26
+ of the state entities of `E` are all well-formed.
27
+
28
+ Given an object `t` of type `T`, where
29
+
30
+ - `t` is a unary function object that accepts a range argument,
31
+ - `T` models `derived_from<range_adaptor_closure<T>>`,
32
+ - `T` has no other base classes of type `range_adaptor_closure<U>` for
33
+ any other type `U`, and
34
+ - `T` does not model `range`
35
+
36
+ then the implementation ensures that `t` is a range adaptor closure
37
+ object.
38
+
39
+ The template parameter `D` for `range_adaptor_closure` may be an
40
+ incomplete type. If an expression of type cv `D` is used as an operand
41
+ to the `|` operator, `D` shall be complete and model
42
+ `derived_from<range_adaptor_closure<D>>`. The behavior of an expression
43
+ involving an object of type cv `D` as an operand to the `|` operator is
44
+ undefined if overload resolution selects a program-defined `operator|`
45
+ function.
46
+
47
+ If an expression of type cv `U` is used as an operand to the `|`
48
+ operator, where `U` has a base class of type `range_adaptor_closure<T>`
49
+ for some type `T` other than `U`, the behavior is undefined.
50
+
51
+ The behavior of a program that adds a specialization for
52
+ `range_adaptor_closure` is undefined.
53
 
54
  A *range adaptor object* is a customization point object
55
  [[customization.point.object]] that accepts a `viewable_range` as its
56
+ first argument and returns a view.
57
 
58
  If a range adaptor object accepts only one argument, then it is a range
59
  adaptor closure object.
60
 
61
+ If a range adaptor object `adaptor` accepts more than one argument, then
62
+ let `range` be an expression such that `decltype((range))` models
63
+ `viewable_range`, let `args...` be arguments such that
64
+ `adaptor(range, args...)` is a well-formed expression as specified in
65
+ the rest of subclause  [[range.adaptors]], and let `BoundArgs` be a pack
66
+ that denotes `decay_t<decltype((args))>...`. The expression
67
+ `adaptor(args...)` produces a range adaptor closure object `f` that is a
68
+ perfect forwarding call wrapper [[term.perfect.forwarding.call.wrapper]]
69
+ with the following properties:
70
 
71
+ - Its target object is a copy of `adaptor`.
72
+ - Its bound argument entities `bound_args` consist of objects of types
73
+ `BoundArgs...` direct-non-list-initialized with
74
+ `std::forward<decltype((args))>(args)...`, respectively.
75
+ - Its call pattern is `adaptor(r, bound_args...)`, where `r` is the
76
+ argument used in a function call expression of `f`.
77
 
78
+ The expression `adaptor(args...)` is well-formed if and only if the
79
+ initialization of the bound argument entities of the result, as
80
+ specified above, are all well-formed.
81