I wanted to replace my "memcpy" with "std::copy", but I just can't find the right way for passing the args.
My old memcpy code was
memcpy(&uFeatures.Features[0], &((char*)(m_pData))[iBytePos],iByteCount);
I tried various things with std::copy, but they all did not work.
Could anybody help, please?
from your syntax it seems it will be smething like this. (assuming Features[0] is char*, if not you need to cast (check comments) )
std::copy(&uFeatures.Features[0], &uFeatures.Features[0]+iByteCount, &((char*)(m_pData))[iBytePos])
and as I see in your comments
I would like to let the compiler decide what it prefers (memcopy, memmove or anything else), that is why I want to use std::copy
std::copy
will not be translated to memcpy
by compiler. they are unrelated. copy will do something like this
while (first != last) {
*d_first++ = *first++;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With