]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. | |
3 | / Copyright (c) 2003-2008 Peter Dimov | |
4 | / | |
5 | / Distributed under the Boost Software License, Version 1.0. (See | |
6 | / accompanying file LICENSE_1_0.txt or copy at | |
7 | / http://www.boost.org/LICENSE_1_0.txt) | |
8 | /] | |
9 | ||
10 | [section:interface Interface] | |
11 | ||
12 | [section:synopsys Synopsis] | |
13 | ||
14 | namespace boost | |
15 | { | |
16 | // no arguments | |
17 | ||
18 | template<class R, class F> ``/unspecified-1/`` ``[link bind_1 `bind`]``(F f); | |
19 | ||
20 | template<class F> ``/unspecified-1-1/`` ``[link bind_1_1 `bind`]``(F f); | |
21 | ||
22 | template<class R> ``/unspecified-2/`` ``[link bind_2 `bind`]``(R (*f) ()); | |
23 | ||
24 | // one argument | |
25 | ||
26 | template<class R, class F, class A1> ``/unspecified-3/`` ``[link bind_3 `bind`]``(F f, A1 a1); | |
27 | ||
28 | template<class F, class A1> ``/unspecified-3-1/`` ``[link bind_3_1 `bind`]``(F f, A1 a1); | |
29 | ||
30 | template<class R, class B1, class A1> ``/unspecified-4/`` ``[link bind_4 `bind`]``(R (*f) (B1), A1 a1); | |
31 | ||
32 | template<class R, class T, class A1> ``/unspecified-5/`` ``[link bind_5 `bind`]``(R (T::*f) (), A1 a1); | |
33 | ||
34 | template<class R, class T, class A1> ``/unspecified-6/`` ``[link bind_6 `bind`]``(R (T::*f) () const, A1 a1); | |
35 | ||
36 | template<class R, class T, class A1> ``/unspecified-6-1/`` ``[link bind_6_1 `bind`]``(R T::*f, A1 a1); | |
37 | ||
38 | // two arguments | |
39 | ||
40 | template<class R, class F, class A1, class A2> ``/unspecified-7/`` ``[link bind_7 `bind`]``(F f, A1 a1, A2 a2); | |
41 | ||
42 | template<class F, class A1, class A2> ``/unspecified-7-1/`` ``[link bind_7_1 `bind`]``(F f, A1 a1, A2 a2); | |
43 | ||
44 | template<class R, class B1, class B2, class A1, class A2> ``/unspecified-8/`` ``[link bind_8 `bind`]``(R (*f) (B1, B2), A1 a1, A2 a2); | |
45 | ||
46 | template<class R, class T, class B1, class A1, class A2> ``/unspecified-9/`` ``[link bind_9 `bind`]``(R (T::*f) (B1), A1 a1, A2 a2); | |
47 | ||
48 | template<class R, class T, class B1, class A1, class A2> ``/unspecified-10/`` ``[link bind_10 `bind`]``(R (T::*f) (B1) const, A1 a1, A2 a2); | |
49 | ||
50 | // implementation defined number of additional overloads for more arguments | |
51 | } | |
52 | ||
53 | namespace | |
54 | { | |
55 | ``/unspecified-placeholder-type-1/`` _1; | |
56 | ||
57 | ``/unspecified-placeholder-type-2/`` _2; | |
58 | ||
59 | ``/unspecified-placeholder-type-3/`` _3; | |
60 | ||
61 | // implementation defined number of additional placeholder definitions | |
62 | } | |
63 | ||
64 | [endsect] | |
65 | ||
66 | [section Common requirements] | |
67 | ||
68 | All /unspecified-N/ types returned by `bind` are /CopyConstructible/. /unspecified-N/`::result_type` is defined as the return type of /unspecified-N/`::operator()`. | |
69 | ||
70 | All /unspecified-placeholder-N/ types are /CopyConstructible/. Their copy constructors do not throw exceptions. | |
71 | ||
72 | [endsect] | |
73 | ||
74 | [section Common definitions] | |
75 | ||
76 | The function \u03BC`(x, v1, v2, ..., vm)`, where `m` is a nonnegative integer, is | |
77 | defined as: | |
78 | ||
79 | * `x.get()`, when `x` is of type [@boost:/libs/core/doc/html/core/ref.html `boost::reference_wrapper`]`<T>` for some type | |
80 | `T`; | |
81 | ||
82 | * `vk`, when `x` is (a copy of) the placeholder /_k/ for some positive integer | |
83 | /k/; | |
84 | ||
85 | * `x(v1, v2, ..., vm)` when `x` is (a copy of) a function object returned by | |
86 | `bind`; | |
87 | ||
88 | * `x` otherwise. | |
89 | ||
90 | [endsect] | |
91 | ||
92 | [section `bind`] | |
93 | ||
94 | [#bind_1] | |
95 | ||
96 | template<class R, class F> ``/unspecified-1/`` bind(F f) | |
97 | ||
98 | * /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)` | |
99 | is equivalent to `f()`, implicitly converted to `R`. | |
100 | ||
101 | * /Throws:/ Nothing unless the copy constructor of `F` throws an exception. | |
102 | ||
103 | [#bind_1_1] | |
104 | ||
105 | template<class F> ``/unspecified-1-1/`` bind(F f) | |
106 | ||
107 | * /Effects:/ Equivalent to `bind<typename F::result_type, F>(f)`. | |
108 | ||
109 | * /Notes:/ Implementations are allowed to infer the return type of `f` via other | |
110 | means as an extension, without relying on the `result_type` member. | |
111 | ||
112 | [#bind_2] | |
113 | ||
114 | template<class R> ``/unspecified-2/`` bind(R (*f) ()) | |
115 | ||
116 | * /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)` | |
117 | is equivalent to `f()`. | |
118 | ||
119 | * /Throws:/ Nothing. | |
120 | ||
121 | [#bind_3] | |
122 | ||
123 | template<class R, class F, class A1> ``/unspecified-3/`` bind(F f, A1 a1) | |
124 | ||
125 | * /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)` | |
126 | is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm))`, implicitly converted to `R`. | |
127 | ||
128 | * /Throws:/ Nothing unless the copy constructors of `F` or `A1` throw an exception. | |
129 | ||
130 | [#bind_3_1] | |
131 | ||
132 | template<class F, class A1> ``/unspecified-3-1/`` bind(F f, A1 a1) | |
133 | ||
134 | * /Effects:/ Equivalent to `bind<typename F::result_type, F, A1>(f, a1)`. | |
135 | ||
136 | * /Notes:/ Implementations are allowed to infer the return type of `f` via other | |
137 | means as an extension, without relying on the `result_type` member. | |
138 | ||
139 | [#bind_4] | |
140 | ||
141 | template<class R, class B1, class A1> ``/unspecified-4/`` bind(R (*f) (B1), A1 a1) | |
142 | ||
143 | * /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)` | |
144 | is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm))`. | |
145 | ||
146 | * /Throws:/ Nothing unless the copy constructor of `A1` throws an exception. | |
147 | ||
148 | [#bind_5] | |
149 | ||
150 | template<class R, class T, class A1> ``/unspecified-5/`` bind(R (T::*f) (), A1 a1) | |
151 | ||
152 | * /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1)`. | |
153 | ||
154 | [#bind_6] | |
155 | ||
156 | template<class R, class T, class A1> ``/unspecified-6/`` bind(R (T::*f) () const, A1 a1) | |
157 | ||
158 | * /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1)`. | |
159 | ||
160 | [#bind_6_1] | |
161 | ||
162 | template<class R, class T, class A1> ``/unspecified-6-1/`` bind(R T::*f, A1 a1) | |
163 | ||
164 | * /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1)`. | |
165 | ||
166 | [#bind_7] | |
167 | ||
168 | template<class R, class F, class A1, class A2> ``/unspecified-7/`` bind(F f, A1 a1, A2 a2) | |
169 | ||
170 | * /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)` | |
171 | is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm), `\u03BC`(a2, v1, v2, ..., vm))`, | |
172 | implicitly converted to `R`. | |
173 | ||
174 | * /Throws:/ Nothing unless the copy constructors of `F`, `A1` or `A2` throw an | |
175 | exception. | |
176 | ||
177 | [#bind_7_1] | |
178 | ||
179 | template<class F, class A1, class A2> ``/unspecified-7-1/`` bind(F f, A1 a1, A2 a2) | |
180 | ||
181 | * /Effects:/ Equivalent to `bind<typename F::result_type, F, A1, A2>(f, a1, a2)`. | |
182 | ||
183 | * /Notes:/ Implementations are allowed to infer the return type of `f` via other | |
184 | means as an extension, without relying on the `result_type` member. | |
185 | ||
186 | [#bind_8] | |
187 | ||
188 | template<class R, class B1, class B2, class A1, class A2> ``/unspecified-8/`` bind(R (*f) (B1, B2), A1 a1, A2 a2) | |
189 | ||
190 | * /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)` | |
191 | is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm), `\u03BC`(a2, v1, v2, ..., vm))`. | |
192 | ||
193 | * /Throws:/ Nothing unless the copy constructors of `A1` or `A2` throw an exception. | |
194 | ||
195 | [#bind_9] | |
196 | ||
197 | template<class R, class T, class B1, class A1, class A2> ``/unspecified-9/`` bind(R (T::*f) (B1), A1 a1, A2 a2) | |
198 | ||
199 | * /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1, a2)`. | |
200 | ||
201 | [#bind_10] | |
202 | ||
203 | template<class R, class T, class B1, class A1, class A2> ``/unspecified-10/`` bind(R (T::*f) (B1) const, A1 a1, A2 a2) | |
204 | ||
205 | * /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1, a2)`. | |
206 | ||
207 | [endsect] | |
208 | ||
209 | [section Additional overloads] | |
210 | ||
211 | Implementations are allowed to provide additional `bind` overloads in order to | |
212 | support more arguments or different function pointer variations. | |
213 | ||
214 | [endsect] | |
215 | ||
216 | [endsect] |