lundi 29 décembre 2014

How to iterate over the template list in variadic templates [duplicate]


This question already has an answer here:




I'm trying to write a generic function with the following idea :



template<typename... T>
void allocateArrays (int count, int N, void** &pointers) {
pointers = new void*[N];
for (int i = 0; i < N; ++i) {
pointers[i] = malloc((sizeof(T[i])) * count);
}
}


Means, I want to get the type of a particular T on every iteration and call the sizeof function over it. But I'm not able to get how to do it exactly.


Aucun commentaire:

Enregistrer un commentaire