How severe is the efficiency loss between using memcpy and std::copy?
I have a situation where the vector implementation on my system doesn’t appear to use contiguous memory, which is making me have to std::copy its contents later on rather than doing memcpy(dest, &vec[0], size);. I’m not sure how badly this is likely to impact efficiency.
A reasonably decent implementation will have
std::copycompile to a callmemmovein the situations where this is possible (i.e. the element type is a POD).If your implementation doesn’t have contiguous storage (the C++03 standard requires it),
memmovemight be faster thanstd::copy, but probably not too much. I would start worrying only when you have measurements to show it is indeed an issue.