> > list<int> a; > > sort(a.begin(), a.end()); > > > > This doesn't compile, it looks like valid C++ code. > > But it isn't, since a.begin() is not a random access iterator.
And if one compiles with -D_GLIBCPP_CONCEPT_CHECKS an error will be flagged. (Largely unreadable, as such errors tend to be, but present and comprehendable nonetheless.) -- Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. - Brian W. Kernighan