mardi 28 mars 2017

c++ using an array without calling constructor

My task is to create a template type array without calling the T (template) constructor. After that I want to move some value to this array from another with std::move. How can I do this in c++? Here is my code:

void *temp = malloc((end-begin) * sizeof(T));
for (unsigned int i = begin; i < end; ++i){
    temp[i] = std::move(array[i]);
}

But it isn't work. The compiler says the following: Subscript of pointer to incomplete type 'void'.

Aucun commentaire:

Enregistrer un commentaire