E
ES Kim
Here's a code fragment:
struct S
{
operator size_t();
};
vector<S> v;
find_if(v.begin(), v.end(), bind2nd(less<size_t>(), 10));
It's something like finding an element in v which is less than 10.
You know conversion operators are often troublesome, so I decided to
change it to size_t S::size() const. Then how can I express the predicate
by using only the function objects in the standard?
I know I can do that by S::S(size_t), bool S:perator<(const S&) const,
and bind2nd(less<S>(), 10). But let's leave out that possibility for now.
struct S
{
operator size_t();
};
vector<S> v;
find_if(v.begin(), v.end(), bind2nd(less<size_t>(), 10));
It's something like finding an element in v which is less than 10.
You know conversion operators are often troublesome, so I decided to
change it to size_t S::size() const. Then how can I express the predicate
by using only the function objects in the standard?
I know I can do that by S::S(size_t), bool S:perator<(const S&) const,
and bind2nd(less<S>(), 10). But let's leave out that possibility for now.