You could create a special iterator that acted as a iterator over an array of the corresponding elements to the vector you are sorting by. You will have to create your own reference type as is the case in std::vector. You are going to want to make sure you get move semantics (assuming you are using a modern compiler) right as this will require a whole array of items to be moved and you really don't want that to mean a copy IMO. Assignment for this reference type would iterate over a row of the different vectors, assigning the corresponding value from the other reference's row to the new one.
class my_refrence_type {
private:
//special refrence to know which vector you are sorting by
std::vector<double>& ref_vec;
//refrence so you can get an iterator from the map to preform assignment
std::unordered_map<std::string,std::vector<double>>& map;
//a location in the vectors. this is the row number
int loc;
public:
/* insert constructors here and other blah blah blah*/
my_refrence_type& operator=(my_refrence_type&& x) {
for(auto& vec : map) {
vec.second[loc] = std::move(vec.second[x.loc]);
}
}
//a method to get the reference vector's value so you can create a comparison function
double& get_ref_value() {
return ref_vec[loc];
}
};
So to recap, you need a special reference type that can treat a row across vectors as a single object and an iterator type over these rows. If you get that right sorting should work with plain old std::sort. It will also give you an interesting view over the vectors that might come in handy elsewhere.