title: c++ Sort Vector based on distance to external Point
body: <p>I was wondering if there is a nice way to sort a vector based on some external value.  For instance, I have a vector of k nearest neighbors to a point.  I want to sort this vector based on their distance to the query point.  The query point is not included in the results, and std::sort allows you to define a comparison function for two elements in the vector (rather than each element vs a fixed point).  Is there any pre-built method to do this sort of sort?  Or would I need to build my own custom sorting algorithm?  Thanks</p>