On 3/11/26 19:59, Peter Taraba via Boost wrote:
I've added projection overloads to statsort that address exactly the pattern you described: boost::algorithm::statsort(my_vector, [](const my_complex_type& x) { return x.z; }); The projection must return an arithmetic type, which is then used as the sort key. Both the container and iterator interfaces support it: // Container overload boost::algorithm::statsort(my_vector, [](const my_complex_type& x) { return x.z; }); // Iterator overload boost::algorithm::statsort(my_vector.begin(), my_vector.end(), [](const my_complex_type& x) { return x.z; }); The updated code is on GitHub: https://github.com/drpt78/statsort Does this cover your use case? Happy to hear if there are other patterns I should consider.
Yes, this is exactly what I was looking for. -- Rainer Deyke - rainerd@eldwood.com