end()
should be called on the container, not the iterator, at line 54myset
is aset<observer *>
, so after dereferncing an iterator, you get anobserver*
, at line 56
Try this:
virtual void notifyAll(){
string s=getNewPrice();
set<observer *>::iterator it;
for(it=myset.begin();it!=myset.end();++it)
//^^^^^ HERE
{
(*it)->update(s); // AND HERE
}
}
Additionally, you probably want to change your observer signature to be:
class observer {
public:
virtual void update(const string& s) = 0;
virtual void remove();
};
and update the rest accordingly.