Add facility to sort query results by a std::function