Con questo codice (solo una classe di test):Come avere una struttura con modello con una classe
typedef unsigned short UInt16;
template<class T>
class CClass
{
public:
SValue* getNewSValue(void);
private:
typedef struct {
T *mValue;
T *next;
T *previous;
UInt16 index;
} SValue;
};
template<typename T>
SValue* CClass<T>::getNewSValue(void)
{
return new SValue;
}
ho i seguenti errori:
error C2143: syntax error : missing ';' before '*'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
è possibile utilizzare un Struct all'interno di una classe? Se dichiaro la struttura fuori dalla classe, il modello non vede il modello T
.
+1: questione ben formattata – Chubsdad