It’s many many years since I wrote that, but am fairly certain I hit problems in making it const. I’d certainly prefer to have a const object there.
There’ll be some comparators that need to be mutable in order to work - e.g. I’ve written a few comparators myself which use an internal map to cache properties of the objects that they’re comparing. I guess you could argue that their members could be mutable, but it seems like that’d be working around a problem that shouldn’t exist.
Actually… Could probably just have two sort methods that take const/non-const references. That’d work, but is more duplicated code!