I want to copy a row from a 2d vector in an existing 1d vector. I found a similar tread, which copies into a newly defined vector as such:

vector< data_type > copyRow( vec2d[3].begin(), vec2d[3].end());

Now I want to change this code, so that copyRow already exists. My idea was (to copy row three for example):

copyRow.insert( vec2d[3].begin(), vec2d[3].end());

Unfortunately, this gives me an error:

error: no matching function for call to ‘std::vector<int>::insert(std::vector<int>::iterator, std::vector<int>::iterator)’

I have included vector, so I am guessing this has something to do with the fact that 2d vectors have another type of vectoriterator? I can't use the insert function?

Thanks for any ideas...

Sorry, I missed a param from the insert function. This works:

copyRow.push_back(0); //otherwise copyRow.begin() returns an error
copyRow.insert(copyRow.begin(), vec2d[3].begin(), vec2d[3].end());

Wait -- would a plain assignment suffice?

copyRow = vec2d[3];

That would be the first thing I tried... unfortunately...