template<class T> class matrice{ T ** data; matrice(){ .. } T& operator[](const int& index){ return this->data[index]; } T operator[](const int& index)const{ return this->data[index]; } };
#include template<class T> class Matrice { public: Matrice() { } T& operator[](int index) { return this->data[index]; } T operator[](int index) const { return this->data[index]; } private: T* data; }; int main() { Matrice<double> m; std::cout << m[0] << std::endl; return 0; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question