From Jason Turner

[bind]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfl2_tbqz/{from.md → to.md} +0 -146
tmp/tmpfl2_tbqz/{from.md → to.md} RENAMED
@@ -1,146 +0,0 @@
1
- ### Function template `bind` <a id="bind">[[bind]]</a>
2
-
3
- The function template `bind` returns an object that binds a callable
4
- object passed as an argument to additional arguments.
5
-
6
- #### Function object binders <a id="func.bind">[[func.bind]]</a>
7
-
8
- This subclause describes a uniform mechanism for binding arguments of
9
- callable objects.
10
-
11
- ##### Class template `is_bind_expression` <a id="func.bind.isbind">[[func.bind.isbind]]</a>
12
-
13
- ``` cpp
14
- namespace std {
15
- template<class T> struct is_bind_expression
16
- : integral_constant<bool, see below> { };
17
- }
18
- ```
19
-
20
- `is_bind_expression` can be used to detect function objects generated by
21
- `bind`. `bind` uses `is_bind_expression` to detect subexpressions. Users
22
- may specialize this template to indicate that a type should be treated
23
- as a subexpression in a `bind` call.
24
-
25
- If `T` is a type returned from `bind`, `is_bind_expression<T>` shall be
26
- publicly derived from `integral_constant<bool, true>`, otherwise from
27
- `integral_constant<bool, false>`.
28
-
29
- `is_placeholder` can be used to detect the standard placeholders `_1`,
30
- `_2`, and so on. `bind` uses `is_placeholder` to detect placeholders.
31
- Users may specialize this template to indicate a placeholder type.
32
-
33
- If `T` is the type of `std::placeholders::_J`, `is_placeholder<T>` shall
34
- be publicly derived from `integral_constant<int, J>`, otherwise from
35
- `integral_constant<int, 0>`.
36
-
37
- ##### Function template `bind` <a id="func.bind.bind">[[func.bind.bind]]</a>
38
-
39
- In the text that follows, the following names have the following
40
- meanings:
41
-
42
- - `FD` is the type `decay<F>::type`,
43
- - `fd` is an lvalue of type `FD` constructed from `std::forward<F>(f)`,
44
- - `Ti` is the iᵗʰ type in the template parameter back `BoundArgs`,
45
- - `TiD` is the type `decay<Ti>::type`,
46
- - `ti` is the iᵗʰ argument in the function parameter pack `bound_args`,
47
- - `tid` is an lvalue of type `TiD` constructed from
48
- `std::forward<Ti>(ti)`,
49
- - `Uj` is the jᵗʰ deduced type of the `UnBoundArgs&&...` parameter of
50
- the forwarding call wrapper, and
51
- - `uj` is the jᵗʰ argument associated with `Uj`.
52
-
53
- ``` cpp
54
- template<class F, class... BoundArgs>
55
- unspecified bind(F&& f, BoundArgs&&... bound_args);
56
- ```
57
-
58
- *Requires:* `is_constructible<FD, F>::value` shall be `true`. For each
59
- `Ti` in `BoundArgs`, `is_constructible<TiD, Ti>::value` shall be `true`.
60
- *`INVOKE`*` (fd, w1, w2, ..., wN)` ([[func.require]]) shall be a valid
61
- expression for some values *w1, w2, ..., wN*, where
62
- `N == sizeof...(bound_args)`.
63
-
64
- *Returns:* A forwarding call wrapper `g` with a weak result
65
- type ([[func.require]]). The effect of `g(u1, u2, ..., uM)` shall be
66
- *`INVOKE`*`(fd, v1, v2, ..., vN, result_of<FD `*`cv`*` (V1, V2, ..., VN)>::type)`,
67
- where *`cv`* represents the *cv*-qualifiers of `g` and the values and
68
- types of the bound arguments `v1, v2, ..., vN` are determined as
69
- specified below. The copy constructor and move constructor of the
70
- forwarding call wrapper shall throw an exception if and only if the
71
- corresponding constructor of `FD` or of any of the types `TiD` throws an
72
- exception.
73
-
74
- *Throws:* Nothing unless the construction of `fd` or of one of the
75
- values `tid` throws an exception.
76
-
77
- *Remarks:* The return type shall satisfy the requirements of
78
- `MoveConstructible`. If all of `FD` and `TiD` satisfy the requirements
79
- of `CopyConstructible`, then the return type shall satisfy the
80
- requirements of `CopyConstructible`. This implies that all of `FD` and
81
- `TiD` are `MoveConstructible`.
82
-
83
- ``` cpp
84
- template<class R, class F, class... BoundArgs>
85
- unspecified bind(F&& f, BoundArgs&&... bound_args);
86
- ```
87
-
88
- *Requires:* `is_constructible<FD, F>::value` shall be `true`. For each
89
- `Ti` in `BoundArgs`, `is_constructible<TiD, Ti>::value` shall be `true`.
90
- *`INVOKE`*`(fd, w1, w2, ..., wN)` shall be a valid expression for some
91
- values *w1, w2, ..., wN*, where `N == sizeof...(bound_args)`.
92
-
93
- *Returns:* A forwarding call wrapper `g` with a nested type
94
- `result_type` defined as a synonym for `R`. The effect of
95
- `g(u1, u2, ..., uM)` shall be *`INVOKE`*`(fd, v1, v2, ..., vN, R)`,
96
- where the values and types of the bound arguments `v1, v2, ..., vN` are
97
- determined as specified below. The copy constructor and move constructor
98
- of the forwarding call wrapper shall throw an exception if and only if
99
- the corresponding constructor of `FD` or of any of the types `TiD`
100
- throws an exception.
101
-
102
- *Throws:* Nothing unless the construction of `fd` or of one of the
103
- values `tid` throws an exception.
104
-
105
- *Remarks:* The return type shall satisfy the requirements of
106
- `MoveConstructible`. If all of `FD` and `TiD` satisfy the requirements
107
- of `CopyConstructible`, then the return type shall satisfy the
108
- requirements of `CopyConstructible`. This implies that all of `FD` and
109
- `TiD` are `MoveConstructible`.
110
-
111
- The values of the *bound arguments* `v1, v2, ..., vN` and their
112
- corresponding types `V1, V2, ..., VN` depend on the types `TiD` derived
113
- from the call to `bind` and the *cv*-qualifiers *cv* of the call wrapper
114
- `g` as follows:
115
-
116
- - if `TiD` is `reference_wrapper<T>`, the argument is `tid.get()` and
117
- its type `Vi` is `T&`;
118
- - if the value of `is_bind_expression<TiD>::value` is `true`, the
119
- argument is `tid(std::forward<Uj>({}uj)...)` and its type `Vi` is
120
- `result_of<TiD cv (Uj...)>::type`;
121
- - if the value `j` of `is_placeholder<TiD>::value` is not zero, the
122
- argument is `std::forward<Uj>(uj)` and its type `Vi` is `Uj&&`;
123
- - otherwise, the value is `tid` and its type `Vi` is `TiD cv &`.
124
-
125
- ##### Placeholders <a id="func.bind.place">[[func.bind.place]]</a>
126
-
127
- ``` cpp
128
- namespace std {
129
- namespace placeholders {
130
- // M is the implementation-defined number of placeholders
131
- extern unspecified _1;
132
- extern unspecified _2;
133
- .
134
- .
135
- .
136
- extern unspecified _M;
137
- }
138
- }
139
- ```
140
-
141
- All placeholder types shall be `DefaultConstructible` and
142
- `CopyConstructible`, and their default constructors and copy/move
143
- constructors shall not throw exceptions. It is *implementation-defined*
144
- whether placeholder types are `CopyAssignable`. `CopyAssignable`
145
- placeholders’ copy assignment operators shall not throw exceptions.
146
-