mercredi 1 juillet 2015

Allocating an array in a templated class

The template I'm using is

template<typename T, size_type MAX_DIM = 500>

I am trying to figure out how to allocate correctly. The variable T ** array_ is declared in the constructor. This is what I have right now, but I've tried a few different kinds of syntax to no avail.

array_=new value_type*[dim1_];
    for ( long i = 0u; i < dim1_; i++)
        array_[i] = new value_type[dim2_];

Aucun commentaire:

Enregistrer un commentaire