So, there's this bit of code:
It doesn't compile.. but if you do typedef Package* Moo, and do const Moo& moo = *it, it works.Code:class Package{ public: string name; }; int main(){ set<Package*> packages; // do stuff here set<Package*>::iterator it; for(it = packages.begin(); it != packages.end(); it++){ const Package*& moo = *it; cout << (*it)->name << endl; } return 0; }
Any way I can do this without going into typedefs?