std::is_bind_expression
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <functional>
|
||
template< class T > struct is_bind_expression; |
(C++11以上) | |
T
はstd::bindの呼び出しによって生成された型である場合、このテンプレートは、メンバ定数value等しいtrueを提供しています。その他のタイプのために、value
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.
バインドで生成された関数オブジェクトが呼び出されたときに、このタイプのバインド引数が、関数として呼び出されます:このテンプレートは、それがバインド部分式のタイプであったかのように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.
目次 |
std::integral_constant から継承
メンバ定数
value [静的] |
T is a function object generated by std::bindならば true、そうでなければ false (パブリック静的メンバ定数) |
メンバ関数
operator bool |
オブジェクトを bool に変換します。 value を返します (パブリックメンバ関数) |
operator() (C++14) |
value を返します (パブリックメンバ関数) |
メンバ型
型 | 定義 |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
例
Run this code
#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'; }
出力:
Adding 2 to the sum of 10 and 11 gives 23