c++ using an array without calling constructor -
my task create template type array without calling t (template) constructor. after want move value array std::move. how can in c++? here code: void *temp = malloc((end-begin) * sizeof(t)); (unsigned int = begin; < end; ++i){ temp[i] = std::move(array[i]); } but isn't work. compiler says following: subscript of pointer incomplete type 'void'. an array of void makes no sense. void incomplete type (and has no size), temp[i] generates error you're seeing. to achieve want do, why not use std::vector , , push items become available ? std::vector<t> temp; (unsigned int = begin; < end; ++i){ temp.push_back(std::move(array[i])); }