I have a set of points S that I need to sort based on their angles around a point P. However, I want to avoid specifying a particular starting angle for sorting. My goal is to obtain an ordered set where the angle between the first and last points has the smallest possible value among all potential starting angles.
In essence, I am not concerned with the final sorted set of points; instead, I am seeking the angle of the smallest pie slice that can encompass all the points in the set.
How can I achieve this efficiently in C++? I would appreciate any insights or suggestions on the most effective approach to tackle this problem.

The covering angle is defined as the angle of the traversal between two adjacent angles that would cover all other angles.
Test cases and verification.
https://godbolt.org/z/v9vdWzbGK (c++23 is used for test cases because of range support but the implementation of AngleSpan itself is c++17 )