From Jason Turner

[depr.adaptors]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpus2sbfo0/{from.md → to.md} +0 -205
tmp/tmpus2sbfo0/{from.md → to.md} RENAMED
@@ -1,205 +0,0 @@
1
- ### Function adaptors <a id="depr.adaptors">[[depr.adaptors]]</a>
2
-
3
- The adaptors ptr_fun, mem_fun, mem_fun_ref, and their corresponding
4
- return types are deprecated. The function template `bind`  [[func.bind]]
5
- provides a better solution.
6
-
7
- #### Adaptors for pointers to functions <a id="depr.function.pointer.adaptors">[[depr.function.pointer.adaptors]]</a>
8
-
9
- To allow pointers to (unary and binary) functions to work with function
10
- adaptors the library provides:
11
-
12
- ``` cpp
13
- template <class Arg, class Result>
14
- class pointer_to_unary_function : public unary_function<Arg, Result> {
15
- public:
16
- explicit pointer_to_unary_function(Result (*f)(Arg));
17
- Result operator()(Arg x) const;
18
- };
19
- ```
20
-
21
- `operator()` returns `f(x)`.
22
-
23
- ``` cpp
24
- template <class Arg, class Result>
25
- pointer_to_unary_function<Arg, Result> ptr_fun(Result (*f)(Arg));
26
- ```
27
-
28
- *Returns:* `pointer_to_unary_function<Arg, Result>(f)`.
29
-
30
- ``` cpp
31
- template <class Arg1, class Arg2, class Result>
32
- class pointer_to_binary_function :
33
- public binary_function<Arg1,Arg2,Result> {
34
- public:
35
- explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2));
36
- Result operator()(Arg1 x, Arg2 y) const;
37
- };
38
- ```
39
-
40
- `operator()` returns `f(x,y)`.
41
-
42
- ``` cpp
43
- template <class Arg1, class Arg2, class Result>
44
- pointer_to_binary_function<Arg1,Arg2,Result>
45
- ptr_fun(Result (*f)(Arg1, Arg2));
46
- ```
47
-
48
- *Returns:* `pointer_to_binary_function<Arg1,Arg2,Result>(f)`.
49
-
50
- ``` cpp
51
- int compare(const char*, const char*);
52
- replace_if(v.begin(), v.end(),
53
- not1(bind2nd(ptr_fun(compare), "abc")), "def");
54
- ```
55
-
56
- replaces each `abc` with `def` in sequence `v`.
57
-
58
- #### Adaptors for pointers to members <a id="depr.member.pointer.adaptors">[[depr.member.pointer.adaptors]]</a>
59
-
60
- The purpose of the following is to provide the same facilities for
61
- pointer to members as those provided for pointers to functions in 
62
- [[depr.function.pointer.adaptors]].
63
-
64
- ``` cpp
65
- template <class S, class T> class mem_fun_t
66
- : public unary_function<T*, S> {
67
- public:
68
- explicit mem_fun_t(S (T::*p)());
69
- S operator()(T* p) const;
70
- };
71
- ```
72
-
73
- `mem_fun_t` calls the member function it is initialized with given a
74
- pointer argument.
75
-
76
- ``` cpp
77
- template <class S, class T, class A> class mem_fun1_t
78
- : public binary_function<T*, A, S> {
79
- public:
80
- explicit mem_fun1_t(S (T::*p)(A));
81
- S operator()(T* p, A x) const;
82
- };
83
- ```
84
-
85
- `mem_fun1_t` calls the member function it is initialized with given a
86
- pointer argument and an additional argument of the appropriate type.
87
-
88
- ``` cpp
89
- template<class S, class T> mem_fun_t<S,T>
90
- mem_fun(S (T::*f)());
91
- template<class S, class T, class A> mem_fun1_t<S,T,A>
92
- mem_fun(S (T::*f)(A));
93
- ```
94
-
95
- `mem_fun(&X::f)` returns an object through which `X::f` can be called
96
- given a pointer to an `X` followed by the argument required for `f` (if
97
- any).
98
-
99
- ``` cpp
100
- template <class S, class T> class mem_fun_ref_t
101
- : public unary_function<T, S> {
102
- public:
103
- explicit mem_fun_ref_t(S (T::*p)());
104
- S operator()(T& p) const;
105
- };
106
- ```
107
-
108
- `mem_fun_ref_t` calls the member function it is initialized with given a
109
- reference argument.
110
-
111
- ``` cpp
112
- template <class S, class T, class A> class mem_fun1_ref_t
113
- : public binary_function<T, A, S> {
114
- public:
115
- explicit mem_fun1_ref_t(S (T::*p)(A));
116
- S operator()(T& p, A x) const;
117
- };
118
- ```
119
-
120
- `mem_fun1_ref_t` calls the member function it is initialized with given
121
- a reference argument and an additional argument of the appropriate type.
122
-
123
- ``` cpp
124
- template<class S, class T> mem_fun_ref_t<S,T>
125
- mem_fun_ref(S (T::*f)());
126
- template<class S, class T, class A> mem_fun1_ref_t<S,T,A>
127
- mem_fun_ref(S (T::*f)(A));
128
- ```
129
-
130
- `mem_fun_ref(&X::f)` returns an object through which `X::f` can be
131
- called given a reference to an `X` followed by the argument required for
132
- `f` (if any).
133
-
134
- ``` cpp
135
- template <class S, class T> class const_mem_fun_t
136
- : public unary_function<const T*, S> {
137
- public:
138
- explicit const_mem_fun_t(S (T::*p)() const);
139
- S operator()(const T* p) const;
140
- };
141
- ```
142
-
143
- `const_mem_fun_t` calls the member function it is initialized with given
144
- a pointer argument.
145
-
146
- ``` cpp
147
- template <class S, class T, class A> class const_mem_fun1_t
148
- : public binary_function<const T*, A, S> {
149
- public:
150
- explicit const_mem_fun1_t(S (T::*p)(A) const);
151
- S operator()(const T* p, A x) const;
152
- };
153
- ```
154
-
155
- `const_mem_fun1_t` calls the member function it is initialized with
156
- given a pointer argument and an additional argument of the appropriate
157
- type.
158
-
159
- ``` cpp
160
- template<class S, class T> const_mem_fun_t<S,T>
161
- mem_fun(S (T::*f)() const);
162
- template<class S, class T, class A> const_mem_fun1_t<S,T,A>
163
- mem_fun(S (T::*f)(A) const);
164
- ```
165
-
166
- `mem_fun(&X::f)` returns an object through which `X::f` can be called
167
- given a pointer to an `X` followed by the argument required for `f` (if
168
- any).
169
-
170
- ``` cpp
171
- template <class S, class T> class const_mem_fun_ref_t
172
- : public unary_function<T, S> {
173
- public:
174
- explicit const_mem_fun_ref_t(S (T::*p)() const);
175
- S operator()(const T& p) const;
176
- };
177
- ```
178
-
179
- `const_mem_fun_ref_t` calls the member function it is initialized with
180
- given a reference argument.
181
-
182
- ``` cpp
183
- template <class S, class T, class A> class const_mem_fun1_ref_t
184
- : public binary_function<T, A, S> {
185
- public:
186
- explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
187
- S operator()(const T& p, A x) const;
188
- };
189
- ```
190
-
191
- `const_mem_fun1_ref_t` calls the member function it is initialized with
192
- given a reference argument and an additional argument of the appropriate
193
- type.
194
-
195
- ``` cpp
196
- template<class S, class T> const_mem_fun_ref_t<S,T>
197
- mem_fun_ref(S (T::*f)() const);
198
- template<class S, class T, class A> const_mem_fun1_ref_t<S,T,A>
199
- mem_fun_ref(S (T::*f)(A) const);
200
- ```
201
-
202
- `mem_fun_ref(&X::f)` returns an object through which `X::f` can be
203
- called given a reference to an `X` followed by the argument required for
204
- `f` (if any).
205
-