std::is_bind_expression
提供: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. |
| Defined in header <functional>
|
||
| template< class T > struct is_bind_expression; |
(C + + 11以来) | |
Tはstd::bindの呼び出しによって生成された型である場合、このテンプレートは、メンバ定数value等しいtrueを提供しています。その他のタイプのために、valuefalseです.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.
バインドで生成された関数オブジェクトが呼び出されたときに、このタイプのバインド引数が、関数として呼び出されます:このテンプレートは、それがバインド部分式のタイプであったかのようにstd::bindによって扱われるべきであるユーザー定義型に特化することができるオブジェクトとバインドで生成したオブジェクトに渡されたすべてのバインドされていない引数が与えられます.
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.
目次 |
Inherited from std::integral_constant
Member constants
| value [静的] |
true T is a function object generated by std::bindもし、そうでなければfalse Original: The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共の静的メンバ定数) |
Member functions
| operator bool |
boolにオブジェクトは、 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. (パブリックメンバ関数) |
Member types
| タイプ
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> |
[編集] 例
#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
[編集] も参照してください
| (C++11) |
関数オブジェクトに1つ以上の引数をバインドします 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. (関数テンプレート) |