If I have two stl vectors vect1, vect2 and I want to produce from them a map, so first element from vect1 will correspond to first element in vect2 and so on. How can I do t
assuming, you are going to ignore the extra (size of vect1 != size of vect2), this could be a solution:
map target; //vector vect1, vector vect2;
vector::iterator it1 = vect1.begin();
vector::iterator it2 = vect2.begin();
while(it1 != vect1.end() && it2 != vect2.end())
{
target.insert(std::make_pair(*it1, *it2));
it1++;it2++;
}
EDIT : Thanks Nim for pointing out *it1 thing.