Classe de matrice C ++

En C, si je voulais créer une matrice de struct, je voudrais utiliser:

struct matrix {
  int col, row;
  double data[1]; //I want the matrix entries stored
                  //right after this struct
}

Alors je peux allouer à

matrix* allocate_matrix(int row, int col) {
  matrix* m = malloc(sizeof(matrix) + sizeof(double) * (row * col - 1));
  m->row = row; m->col = col;
  return m;
}

Maintenant dois-je faire l'équivalent en C++?

EDIT:

Je veux savoir le cannonical façon de mettre en œuvre une matrice de classe en C++.

source d'informationauteur anon | 2010-01-16