X
Xavier Serrand
The following code don't raise even a warning with DevC++ but with VC6 :
Compiler Error C2908 : explicit specialization; 'template' has already been
specialized from the primary template
with the following code
template <typename T> struct Elem_
{
long x; /* coordonnée x de l'élément */
long y; /* coordonnée y de l'élément */
T el; /* élément d'indice <x,y> */
/* Résolution des collisions */
struct Elem_ * next_x; /* résol. pour des x de même indice selon h1 */
struct Elem_ * next_y; /* résol. pour des y de même indice selon h2 */
};
template <typename T> struct TableDisp_
{
struct Elem_<T> ** table; //Compiler Error C2908 with VC6 only (not with
DevC++ )
long nbEntrees;
};
template <typename T> class MatrixCRS
{
typedef struct Elem_<T> Element; //Compiler Error C2908 with VC6 only (not
with DevC++ )
public:
MatrixCRS() {};
MatrixCRS(T defaultValue);
~MatrixCRS();
T getDefaultElt();
private:
T m_default;
};
I can fix the problem putting all declarations in the class ... but i would
like to find a way to have structs declarations outside the class
MatrixCRS... is it possible ? is it a good idea?
thanks to any advise
Compiler Error C2908 : explicit specialization; 'template' has already been
specialized from the primary template
with the following code
template <typename T> struct Elem_
{
long x; /* coordonnée x de l'élément */
long y; /* coordonnée y de l'élément */
T el; /* élément d'indice <x,y> */
/* Résolution des collisions */
struct Elem_ * next_x; /* résol. pour des x de même indice selon h1 */
struct Elem_ * next_y; /* résol. pour des y de même indice selon h2 */
};
template <typename T> struct TableDisp_
{
struct Elem_<T> ** table; //Compiler Error C2908 with VC6 only (not with
DevC++ )
long nbEntrees;
};
template <typename T> class MatrixCRS
{
typedef struct Elem_<T> Element; //Compiler Error C2908 with VC6 only (not
with DevC++ )
public:
MatrixCRS() {};
MatrixCRS(T defaultValue);
~MatrixCRS();
T getDefaultElt();
private:
T m_default;
};
I can fix the problem putting all declarations in the class ... but i would
like to find a way to have structs declarations outside the class
MatrixCRS... is it possible ? is it a good idea?
thanks to any advise