print ファンクターの最初の引数を 0 にバインドしたいと思います。
#include<iostream>
#include<functional>
using namespace std;
class Print : public std::binary_function<int,int,void>{
public:
void operator()(int val1, int val2)
{
cout << val1 + val2 << endl;
}
};
int main()
{
Print print;
binder1st(print,0) f; //this is line 16
f(3); //should print 3
}
上記のプログラム ( C++ Primer Plusの例に基づく) はコンパイルされません。
line16 : error : missing template arguments before ‘(’ token
なにが問題ですか?
C++11 もブースト機能も使いたくありません。
編集: 簡単にするために、operator() の戻り値の型が bool から void に変更されました