Difference between revisions of "cpp/utility/functional/placeholders"
(+seealso. the example here feels complicated.) |
(+details) |
||
Line 11: | Line 11: | ||
}} | }} | ||
{{ddcl list end}} | {{ddcl list end}} | ||
− | + | ||
− | The {{cpp|std::placeholders}} namespace contains the placeholder objects {{tt|[_1, . . . _N]}} where {{tt|N}} | + | The {{cpp|std::placeholders}} namespace contains the placeholder objects {{tt|[_1, . . . _N]}} where {{tt|N}} is an implementation defined maximum number. |
+ | |||
+ | When used as an argument in a {{cpp|std::bind}} expression, the placeholder objects are stored in the generated function object, and when that function object is invoked with unbound arguments, each placeholder {{tt|_N}} is replaced by the corresponding Nth unbound argument. | ||
+ | |||
+ | The types of the placeholder objects are DefaultConstructible and CopyConstructible, their default copy/move constructors do not throw exceptions, and for for any placeholder {{tt|_N}}, the type {{cpp|std::is_placeholder<decltype(_N)>}} is defined and is derived from {{cpp|std::numeric_constant<int, N>}}. | ||
===Example=== | ===Example=== |
Revision as of 19:30, 7 December 2011
Template:cpp/utility/functional/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td><functional>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td class="t-dcl-nopad">extern /*unspecified*/ _2;
.
.
<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end
The Template:cpp namespace contains the placeholder objects [_1, . . . _N]
where N
is an implementation defined maximum number.
When used as an argument in a Template:cpp expression, the placeholder objects are stored in the generated function object, and when that function object is invoked with unbound arguments, each placeholder _N
is replaced by the corresponding Nth unbound argument.
The types of the placeholder objects are DefaultConstructible and CopyConstructible, their default copy/move constructors do not throw exceptions, and for for any placeholder _N
, the type Template:cpp is defined and is derived from Template:cpp.
Example
See also
(C++11) |
binds one or more arguments to a function object (function template) |
(C++11) |
indicates that an object is a standard placeholder or can be used as one (class template) |