Okay. I added a class object that will do the minus manually.
Code:
template <typename T>
class DecreaseOne : public std::binary_function<T, T, void>
{
public:
void operator()(T &lp, const T &rp)
{
lp -= rp;
}
};
[/code]
Here the call to it.
Code:
std::for_each(std::find_if(theList.begin(), theList.end(), std::bind2nd(std::greater<size_t>(), 6)), theList.end(), std::bind2nd(DecreaseOne<size_t>(), 1));
The compiler will not compile. Here is the errors.
Code:
error C2064: term does not evaluate to a function
error C2662: 'DecreaseOne<unsigned int>::operator`()'' : cannot convert 'this' pointer from 'const DecreaseOne<T>' to 'DecreaseOne<T> &'
with
[
T=size_t
]
and
[
T=size_t
]
I defined DecreaseOne functor as a global class.
What is the problem?
Thanks,
Kuphryn