c++ - creating a map from two vectors -
if have 2 stl vectors vect1, vect2 , want produce them map, first element vect1 correspond first element in vect2 , on. how can in simple way?
std::vector<int> a, b; // fill vectors here... std::map<int, int> m; assert(a.size() == b.size()); (size_t = 0; < a.size(); ++i) m[a[i]] = b[i];
Comments
Post a Comment