Quote:Original post by Antheus
enemySpawnLists is declared or passed as const. const containers cannot be sorted.
Where does enemySpawnLists come from?
enemySpawnLists definitely isn't declared const and I'm pretty sure it's never passed as const anywhere. It's just the iterators of enemySpawnList that are passed const, that should be ok, right?
enemySpawnLists is a part of the World class.
Quote:Original post by tivolo
The second error means that you probably mixed up free functions/member functions. If you want sortEnemies to be a member function, then it must be declared static (otherwise it needs the this-pointer).
Hmm... I tried this-> and it still tells me I'm missing the argument list.
Also, it still says:
error C2780: 'void std::sort(_RanIt,_RanIt)' : expects 2 arguments - 3 provided
Which sounds like it's mistaking the 3 argument sort for the 2 argument sort...
Quote:Original post by Aardvajk
Or getY() is not declared as a const member (which it almost certainly should be):
class Whatever{public: int getY() const { return y; }};
Ah, that solved that problem. I was wondering what was wrong since I knew the objects were const but getY() didn't change anything. How does that work? Does it now allow const objects to call functions unless they're declared const and thereby are certain not to change anything? I have to admit I don't remember ever even seeing const in a function declaration after the function name...