#include <iostream>
#include <algorithm>
#include <iterator>
#include <functional>
class A
{
public:
bool operator()(int x, int y)
{
return x > y;
}
};
int main()
{
int array[5] = { 1, 2, 3, 4, 5 };
//std::remove_copy_if(array, array + 5, std::ostream_iterator<int>(std::cout, " "), std::bind2nd(A(), 15)); //ERROR
std::remove_copy_if(array, array + 5, std::ostream_iterator<int>(std::cout, " "), std::bind2nd(std::greater<int>(), 3));//OK
std::cin.get();
return 0;
}
Many Thanks!
I just found, I lost some types definitions(first_argument_type, second_argument_type, result_type).
But I missed the "const" qualifier after "operator()", so the compiler error occured again.
The habit of adding "const" qualifier is so important.