voici un code que je trouve plus juste mais qui me donne une erreur C2935: template-class-id redefined as a global function
Je cherche juste a arreter les appels recursifs au constructeur vide à la declaration de la méthode:
Tensor(const vector<Tensor<U,n-1> > & vTensor_){};
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
# ifndef _TENSOR
# define _TENSOR
#include <math.h>
#include <vector>
#include <iostream>
using namespace std;
template< class U, int n>
class Tensor{
typedef std::vector<int> VI;
typedef std::vector<U> VU;
public:
Tensor(const VI & vNbElem_);
Tensor(const int & NbElem_);
Tensor(const VI & vNbElem_, const VU vTensor_);
Tensor(const int & NbElem_, const VU vTensor_);
Tensor(const vector<Tensor<U,n-1> > & vTensor_){};
Tensor(){};
~Tensor(){};
void Init (const int * pNbElem_);
public:
int Dim;
int NbElemSize;
VI vNbElem;
VU vTensor;
VI::iterator ItNbElem;
VU::iterator ItTensor;
};
template <class U> inline Tensor<U,0>(){};
#include "Tensor.cpp"
# endif |
Partager