My comments on this answer got me thinking about the issues of constness and sorting. I played around a bit and reduced my issues to the fact that this code:
Using just an unspecialized vector, this can't be done. Sorting is done by using assignment. So the same code that makes this possible:
vector
sort(v.begin(), v.end());
...also makes this possible:
v[1] = 123;