C ++ 0xは、genericなどの古いバインダーの使用を廃止しbind1st
ましbind2nd
たstd::bind
。C ++ 0xラムダはとうまくバインドしますが、デフォルトではラムダには、、、、、などのネストされたtypedefがないため、従来のbind1stおよびstd::bind
bind2ndとはバインドしません。したがって、必要なtypedefが公開されるため、ラムダを古いバインダーにバインドする標準的な方法として役立つと思いました。argument_type
first_argument_type
second_argument_type
result_type
std::function
ただし、std::function
このコンテキストでの使用は、インスタンス化中に関数型を詳しく説明する必要があるため、使用するのが困難です。
auto bound =
std::bind1st(std::function<int (int, int)>([](int i, int j){ return i < j; }), 10); // hard to use
auto bound =
std::bind1st(std::make_function([](int i, int j){ return i < j; }), 10); // nice to have but does not compile.
の便利なオブジェクトジェネレータが見つかりませんでしたstd::function
。のようなものstd::make_fuction
があればいいのにと思います。そのようなものは存在しますか?そうでない場合、ラムダを古典的なバインダーに結合する他のより良い方法はありますか?