I have a std::vector<unsigned char>
vec and a pre-allocated contiguous buffer of (unsigned char) with size (len), that I know it's beginning which is stored in an unsigned char*
variable named start
. I know I can use std::copy(start,start+len,vec.begin())
to copy them into the vector, but can I do that without copying? Can I make vec.begin()
point to start pointer? I have all the values already allocated in memory, and I do not want to have to copy them into the vector because I have a memory constraint.
The pointer and length are given to me via an external API, so I cannot change that.