Hello,
I wish to initialize a vector<BYTE> from an existing BYTE array.
Simple example:
This sample works and does what I asked for. The only difference is that it copies the buffer. I want the vector to point to the original BYTE array and not allocate+copy it.
The reason behind this is because I have an old API that sends me a BYTE array (that was read from a file) and I want it in a vector. I can't afford duplicating the BYTE array that I receive because it can get to huge sizes.
Thanks.
I wish to initialize a vector<BYTE> from an existing BYTE array.
Simple example:
Code:
BYTE buf[] = {0,1,2,3,4,5};
std::vector<BYTE> vec(buf, buf + sizeof(buf)/sizeof(buf[0]));
The reason behind this is because I have an old API that sends me a BYTE array (that was read from a file) and I want it in a vector. I can't afford duplicating the BYTE array that I receive because it can get to huge sizes.
Thanks.
Comment