vec1[i] = vec2[i]
will set the value of vec1[i] to the value of vec2[i]. Nothing is inserted. Your second approach is almost correct. Instead of +i+1 you need just +i
v1.insert(v1.begin()+i, v2[i])
vec1[i] = vec2[i]
will set the value of vec1[i] to the value of vec2[i]. Nothing is inserted. Your second approach is almost correct. Instead of +i+1 you need just +i
v1.insert(v1.begin()+i, v2[i])