What happens if I use vector::begin() instead of std::back_inserter(vector) for output of set_intersection?
I have been using the highly concise and intuitive C++ syntax for finding the intersection of two sorted vector s and putting the result in a third vector : vector<bar> a,b,c; //... std::set_intersection(a.begin(),a.end(),b.begin(),b.end(), std::back_inserter(c)); This should set c to intersection( a , b ), assuming a and b are sorted. But what if I just use c.begin() (I thought I saw an example somewhere of this, which is why I did): std::set_intersection(a.begin(),a.end(),b.begin(),b.end(), c.begin()); set_intersection expects an OutputIterator at that parameter. The standard I believe