Wrox の Professional C++からこの単純な test.cpp プログラムをコンパイルしたいと思います。
#include<iostream>
#include<functional>
using namespace std;
void func(int num, const string& str)
{
cout << num << ' ' << str << endl;
}
int main()
{
string str = "abc";
auto f = bind(func, placeholders::_1, str);
f(16);
}
g++ (Debian 4.4.5-8) 4.4.5 コンパイラがあり、次のように使用します。
g++ -std = c++0x test.cpp -o test
エラーが発生します:
error: no match for call to ‘(std::_Bind<void (*(std::_Placeholder<1>, int))
(int, int)>) (int)’
プログラムがコンパイルされないのはなぜですか?
C++ リファレンスのサンプル プログラムもコンパイルできません。