A
ash
Hi,
I'm getting started with STL, and am stuck at creating a map
container. I checked one of the texts and found a code in there. To
make it simple, i wrote the following:
#include <iostream.h>
#include <string.h>
#include <map>
typedef std::map<string,string,std::less<string>> mymap;
int main()
{
mymap somemap;
return 0;
}
This gives me 6 error messages, an a warning. Could anyone point me
the mistake....i've been to grasp the topic for two days now!
Initially i thought i might not be using string properly, so i changed
the code typedef to
typedef std::map<int,int, std::less<int>> mymap;
This give me an error saying :
C:\Documents and Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : error
C2146: syntax error : missing ',' before identifier 'mymap'
C:\Documents and Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : :
error C2065: 'mymap' : undeclared identifier
C:\Documents and Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : error
C2143: syntax error : missing '>' before ';'
C:\Documents and C:\Documents and
Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : warning C4091:
'typedef ' : ignored on left of 'class std::map' when no variable is
declared
Thanks,
Ash
I'm getting started with STL, and am stuck at creating a map
container. I checked one of the texts and found a code in there. To
make it simple, i wrote the following:
#include <iostream.h>
#include <string.h>
#include <map>
typedef std::map<string,string,std::less<string>> mymap;
int main()
{
mymap somemap;
return 0;
}
This gives me 6 error messages, an a warning. Could anyone point me
the mistake....i've been to grasp the topic for two days now!
Initially i thought i might not be using string properly, so i changed
the code typedef to
typedef std::map<int,int, std::less<int>> mymap;
This give me an error saying :
C:\Documents and Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : error
C2146: syntax error : missing ',' before identifier 'mymap'
C:\Documents and Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : :
error C2065: 'mymap' : undeclared identifier
C:\Documents and Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : error
C2143: syntax error : missing '>' before ';'
C:\Documents and C:\Documents and
Settings\Ash\Desktop\Maps\MuliMap\Main.cpp(4) : warning C4091:
'typedef ' : ignored on left of 'class std::map' when no variable is
declared
Thanks,
Ash