mardi 25 mai 2021

Is it possible to use iterators on 3D matrix in a template class?(c++)

i'm trying to use iterators on a 3d matrix allocated dynamically.

   matrix = new T**[height];
        for(int i =0; i<height; i++){
            matrix[i] = new T*[col];
            for(int j =0; j<col; j++){
                matrix[i][j] = new T[row];


            }
        }

Is it possible to iterate over this matrix using iterators? Or is better to choose a different solution using iterators? (no vector solution)

If it's possible, how can I implement them?

Aucun commentaire:

Enregistrer un commentaire