I'm implementing a game. I have a state tree and a set<> based priority queue that sorts the states on their costs. For this I have the < operator implemented as:
struct DereferenceCompareState :
public std::binary_function<State*, State*, bool>
{
bool operator()(const State* lhs, const State* rhs) const
{
verbose6("comparing " << lhs->getCost() << " with " << rhs->getCost());
return lhs->getCost() < rhs->getCost();
}
};
Now, I want to eliminate states that have higher cost than some number, but for this, I have to create a dummy state with the cost I want and do an upper_bound on the set. Is there a way to define an operator that works on state vs integer comparisons by for example adding to the struct above? Thanks