title: Intersection of std::vectors sorted according to different functions
body: <p>I have std::vectors of ints v1, v2, v3, ... v10. Each with a few 100,000s of elements. Each vector is sorted by a different factor (so there are 10 factor functions f1, f2, ... f10). So though they are sorted by themselves, relative to each other they are unsorted. </p>
  
  <p>I want to find the intersection of these 10 vectors and I want to the output to be sorted according one of the factor. For e.g. the result should be sorted according to f1. So when I pass these 10 vectors to that intersect-sort function along with the factor function, I will get an output vector that has only the elements that are present in all vectors, sorted according to f1. What is the best way to do this operation? </p>