A map stores a pair -- a key and a value. Which part do you want to copy? Or, do you want to copy both to two distinct vectors?
I want to copy both. Once that's done, I need to figure out how to sort the vector by the second value in the pair.
template
struct sort_by_val {
bool operator()(V const& l, V const& r) {
return // ...
}
};
vector > outv(map.begin(), map.end());
sort(outv.begin(), outv.end(), sort_by_val());