M
Matthias
Hello,
I thought one major advantage of using functors as e.g. sorting
predicates over functions would be that I can do something like this:
void foo()
{
class Predicate
{
public:
bool operator() (...) {...}
};
std::list<whatever> lst;
// ...
std::transform( lst.begin(), lst.end(), lst.begin(), Predicate() );
}
However, I am getting a compile time error "type foo():redicate
composed from a local class is not a valid template-argument".
Why?
I thought one major advantage of using functors as e.g. sorting
predicates over functions would be that I can do something like this:
void foo()
{
class Predicate
{
public:
bool operator() (...) {...}
};
std::list<whatever> lst;
// ...
std::transform( lst.begin(), lst.end(), lst.begin(), Predicate() );
}
However, I am getting a compile time error "type foo():redicate
composed from a local class is not a valid template-argument".
Why?