tldr: My Goal is to copy all the data where pointers are refering to, to a void buffer.
So I have multiple pointer with different types, which are pointing to their data
const unsigned char * pData8u1 = pContainer1->GetData();
const float * pData32f1 = pContainer2->GetData();
...
const unsigned long long * pData64uN = pContainerN->GetData();
I store the pointers in a void vector and their dataSize in a size_t vector, so I can iterate through all pointers
std::vector<const void *> vecData;
std::vector<const size_t> vecDataSizes;
My Goal is to copy all the data where the pointers are refering to, to a void buffer
void * destinationBuffer // should contain all data
This buffer has a size. I assume:
inputDataSize = std::accumulate(vecDataSizes.begin(), vecDataSizes.end(), 0);
if(inputDataSize == destinationBufferSize && inputDataSize != 0) // condition
{
// do copy
}
How do I copy the data referenced by the pointers to this buffer? I am a bit lost. I tried different ideas (memcpy, copy, ...) but could not realize them. An easy solution would be great, an efficient solution would be a bonus :)
void * destinationBufferis not a buffer. Its just a pointer (that can point to some buffer) - 463035818_is_not_a_number