std::is_bind_expression
Aus cppreference.com
< cpp | utility | functional
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <functional>
|
||
template< class T > struct is_bind_expression; |
(seit C++11) | |
Wenn
T
die Art durch einen Aufruf std::bind produziert wird, bietet diese Vorlage das Mitglied konstanten value gleich true. Für jede andere Art, value
ist false .Original:
If
T
is the type produced by a call to std::bind, this template provides the member constant value equal true. For any other type, value
is false.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Diese Vorlage kann für einen benutzerdefinierten Typ, der durch std::bind behandelt werden, als ob es die Art eines bind Teilausdruck war spezialisiert werden: wenn ein bind-generierten Funktions-Objekt aufgerufen wird, ein gebundenes Argument dieser Art wird als Funktion aufgerufen werden Objekt und werden alle ungebundenen übergebenen Argumente der bind-generierte Objekt gegeben werden .
Original:
This template may be specialized for a user-defined type which should be treated by std::bind as if it was the type of a bind subexpression: when a bind-generated function object is invoked, a bound argument of this type will be invoked as a function object and will be given all the unbound arguments passed to the bind-generated object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
Inherited from std::integral_constant
Member constants
value [statisch] |
true wenn T is a function object generated by std::bind, false anders Original: The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
Member functions
operator bool |
wandelt das Objekt bool, gibt value Original: converts the object to bool, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) |
Member types
Type
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
[Bearbeiten] Beispiel
#include <iostream> #include <type_traits> #include <functional> struct MyBind { typedef int result_type; int operator()(int a, int b) const { return a + b; } }; namespace std { template<> struct is_bind_expression<MyBind> : public true_type {}; } int f(int n1, int n2) { return n1+n2; } int main() { // as if bind(f, bind(MyBind::operator(), _1, _2), 2) auto b = std::bind(f, MyBind(), 2); std::cout << "Adding 2 to the sum of 10 and 11 gives " << b(10, 11) << '\n'; }
Output:
Adding 2 to the sum of 10 and 11 gives 23
[Bearbeiten] Siehe auch
(C++11) |
bindet ein oder mehrere Argumente an eine Funktion Objekt Original: binds one or more arguments to a function object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) |