S
Scoots
I have the following code snippit that the compiler just won't take (vc
++ 6). I want to make a map as a member variable inside a class. So
I've put it into the header file, and it won't take it with the
descriptors, but it doesn't like it if I take them out, either.
(inside my class .h file)
#include <map>
class PRGEdit{
....
protected:
map <CString, Keyword, strCmp> keywordMap();
.....
};
struct strCmp {
bool operator()( const char* s1, const char* s2 ) const {
return strcmp( s1, s2 ) < 0;
}
};
class Keyword{
public:
Keyword();
Keyword(CString newname);
~Keyword();
CString name;
CHARFORMAT* cf;
};
Output:
c:\...\progeditordlg.h(81) : error C2143: syntax error : missing ';'
before '<'
c:\...\progeditordlg.h(81) : error C2501: 'map' : missing storage-
class or type specifiers
c:\...\progeditordlg.h(81) : error C2059: syntax error : '<'
c:\...\progeditordlg.h(81) : error C2238: unexpected token(s)
preceding ';'
I understand that I'm declaring it like it might be used in a .cpp
file, but how do I declare this as a instance variable of the class?
Thanks,
~Scoots
++ 6). I want to make a map as a member variable inside a class. So
I've put it into the header file, and it won't take it with the
descriptors, but it doesn't like it if I take them out, either.
(inside my class .h file)
#include <map>
class PRGEdit{
....
protected:
map <CString, Keyword, strCmp> keywordMap();
.....
};
struct strCmp {
bool operator()( const char* s1, const char* s2 ) const {
return strcmp( s1, s2 ) < 0;
}
};
class Keyword{
public:
Keyword();
Keyword(CString newname);
~Keyword();
CString name;
CHARFORMAT* cf;
};
Output:
c:\...\progeditordlg.h(81) : error C2143: syntax error : missing ';'
before '<'
c:\...\progeditordlg.h(81) : error C2501: 'map' : missing storage-
class or type specifiers
c:\...\progeditordlg.h(81) : error C2059: syntax error : '<'
c:\...\progeditordlg.h(81) : error C2238: unexpected token(s)
preceding ';'
I understand that I'm declaring it like it might be used in a .cpp
file, but how do I declare this as a instance variable of the class?
Thanks,
~Scoots