Possible Duplicate:
How to convert vector to array C++
When working with arrays you have the ability to use
memcpy( void *destination, const void *source, size_t num );
However vectors simply provide iterators for a copy method, rendering memcpy useless. What is the fastest method for copying the contents a vector to another location?
std::copy, hands down. It’s heavily optimised to use the best available method internally. It’s thus completely on par withmemcpy. There is no reason ever to usememcpy, even when copying between C-style arrays or memory buffers.