You only need to include the file boost/sort/sort.hpp.
The flat_stable_sort function is in the namespace boost::sort.#include <boost/sort/sort.hpp> template <class iter_t, typename compare> void flat_stable_sort (iter_t first, iter_t last, compare comp = compare());
This algorithm uses a comparison object, in the same way as the standard library sort algorithms. If you don't define it, the comparison object defaults to std::less, which uses the < operator internally for comparisons.
This algorithm is exception safe, meaning that, the exceptions generated by the algorithm guarantee the integrity of the objects to sort, but not their relative order. If the exception is generated inside the objects (in the move or copy constructors) the results are undefined.