Bonjour,
mon code tourne, mais y'a un truc qui me gene. J'ai cree une classe "normale" (non template) qui contient une fonction template:
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
| class ConfigFile
{
public:
ConfigFile(CString Filename,LogManager *Log)
{
this->Filename = Filename;
this->Log = Log;
bInitialized = TRUE;
}
virtual ~ConfigFile()
{
}
private:
bool bInitialized;
CString Filename;
LogManager *Log;
CString _CSTRING;
CHAR _CHAR;
BOOL _BOOL;
INT8 _INT8;
INT16 _INT16;
INT32 _INT32;
LONG32 _LONG32;
UINT8 _UINT8;
UINT16 _UINT16;
UINT32 _UINT32;
ULONG32 _ULONG32;
FLOAT32 _FLOAT32;
FLOAT64 _FLOAT64;
INT16 ParamType;
public:
template <class MyType> UINT16 ParseFile (CString ParamID,MyType *Param)
{
...
}
}; |
Lorsque j'appelle ma methode template dans un autre code source, je procede comme ca:
1 2 3
| ConfigFile MyCfg("C:\\TestReadParse.ini",MyLM);
MyCfg.ParseFile("Test_INT8",&Test_INT8); |
Mais j'aimerais specifier le type utilise dans ma fonction template, comme ca:
MyCfg.ParseFile <__int8> ("Test_INT8",&Test_INT8);
Mais la, ca compile pas:
error C2062: type '__int8' unexpected
C'est normal ou bien j'ai un bug dans mon code?
Merci d'avance...
G-treize
Partager