boost::functionのテンプレート引数に変数名(関数のパラメータ名)を書く




ほんとにできました。

#include <iostream>
#include <boost/function.hpp>

void foo(int a, int b)
{
    std::cout << a << ", " << b << std::endl;
}

int main()
{
//  boost::function<void(int, int)> f = foo;      // 普段はこう書くけど
    boost::function<void(int a, int b)> f = foo;  // パラメータ名も書ける!

    f(1, 2);
}
1, 2

GCC 4.6とVC++2008で確認。