1. 3
  1.  

  2. 1

    To be clear: There’s nothing wrong with [unstable sorting]. As the caller, if you want stable sorting, you should use std::stable_sort, not std::sort.

    As the vendor, if you don’t intend to guarantee stability, it might be a good idea to break stability for small inputs, just to teach your users not to depend on that property by accident or coincidence.

    I like this principle! Does it have a name?

    It seems related to criticism of the robustness principle. If the interface doesn’t make a guarantee, but the implementation does (or appears to…), then people may rely on it. And you may have to support this “accidental guarantee”.

    1. 2

      The name is Hyrum’s Law.