By "pure" predicates I mean they only depend on their arguments. So is the following function object a valid predicate for use in say, std::sort
// A predicate for sorting objects of type T2 that relies on an
// object of type T1.
class APredicate {
T1 &someObj;
APredicate(T1 &someObject) : someObj(someObject) {};
bool operator() (T2 thing1, T2 thing2) {
return someObj.someFn(thing1) < someobj.someFn(thing2);
}
}
Is this ever valid? Always valid? Or does it depend on what someObj.SomeFn() actually does?