How do I clone vector?

Viewed 29449

I am using vector as an input buffer...

recv = read(m_fd, &m_vbuffer[totalRecv], SIZE_OF_BUFFER);

After it reads all data from the input buffer then it will put the data inside of the vector into the thread pool.

So I was trying to do clone the vector. I think I cannot just pass the pointer to the vector because of the new packets coming in and it overwrites the data inside of the vector.

However, I could not find a way to clone the vector. Please provide me a proper way to handle this. Also I will be very appreciated if you guys point out any problems using vectors as input buffer or tutorials related to this...

3 Answers
Related