C
CQ
Hi there,
I am having the following problem: I have the following class:
class reachGraphState {
protected:
/* ... some stuff .... */
public:
reachGraphState(stateType, bool);
reachGraphState(stateType, bool, State *);
~reachGraphState();
State * state;
static bool sortReachGraphState(const reachGraphState& left, const
reachGraphState& right) {
left.state < right.state;
}
friend bool operator == (const reachGraphState& s1, const
reachGraphState& s2);
friend bool operator < (const reachGraphState& s1, const
reachGraphState& s2);
friend ostream& operator << (std:
stream& os, const
reachGraphState& s);
};
And then I have another class, which shall contain a set of those
reachGraphState-objects. So I did the following:
class stateList {
private:
/* some stuff */
public:
stateList();
~stateList();
set<reachGraphState *, reachGraphState::sortReachGraphState>
myStateSet;
};
But this does not work. Can anyone help me on this. How do I declare an
STL set over objects using a certain sorting function.
Thanks a lot in advance,
CQ.
I am having the following problem: I have the following class:
class reachGraphState {
protected:
/* ... some stuff .... */
public:
reachGraphState(stateType, bool);
reachGraphState(stateType, bool, State *);
~reachGraphState();
State * state;
static bool sortReachGraphState(const reachGraphState& left, const
reachGraphState& right) {
left.state < right.state;
}
friend bool operator == (const reachGraphState& s1, const
reachGraphState& s2);
friend bool operator < (const reachGraphState& s1, const
reachGraphState& s2);
friend ostream& operator << (std:
reachGraphState& s);
};
And then I have another class, which shall contain a set of those
reachGraphState-objects. So I did the following:
class stateList {
private:
/* some stuff */
public:
stateList();
~stateList();
set<reachGraphState *, reachGraphState::sortReachGraphState>
myStateSet;
};
But this does not work. Can anyone help me on this. How do I declare an
STL set over objects using a certain sorting function.
Thanks a lot in advance,
CQ.