Sort elements, but keep certain ones fixed
问题 The function template <typename Container, typename Comparator, typename Predicate> void sortButKeepSomeFixed (Container& c, const Comparator& comp, const Predicate& pred) is to sort the container c according to the ordering criterion comp , but those elements that satisfy pred shall remain fixed in their original positions after the sort (i.e. unaffected by the sort). I tried to adapt quick sort to fit this, but could not think of it. In the end, I decided to adapt the crude selection sort