For C++ sort(), how to pass a parameter to custom compare function?
问题 I want to use the standard sort function for sorting points in respect to their distance of another point (e.g. their barycenter). I know I can write a custom compare function, but I don't know how to pass a parameter to it. I want to have it thread-safe, so I do not want to store the parameter at one central location. Is there a way how to pass additional parameters to a custom compare function? // Here is a compare function without a parameter for sorting by the x-coordinate struct