Problem with stl map in VC++ 6.0, compiler hangs
Hi all,
I have a problem with a stl map in VC++ 6.0.
I create a map with std::string, unsigned long from a file in the
following way:
typedef std::map<std::string, unsigned short> CmdMapType;
typedef std::map<unsigned short, CmdMapType> VersionCmdMapType;
class CCmdMap
{
VersionCmdMapType* versionCmdMap;
....
CCmdMap::CCmdMap()
{
versionCmdMap = new VersionCmdMapType;
CmdMapType* cmdmap = new CmdMapType;
#include "cmdmap1050.c"
(*versionCmdMap)[1050]=*cmdmap;
delete cmdmap;
}
where cmdmap1050.c contains
(*cmdmap)["Msg_OK"] = (unsigned short) 0;
(*cmdmap)["Msg_ERROR"] = (unsigned short) 65535;
etc. This file is generated by an external awk script from a text
file.
So, the map is filled at compile time.
There are about 400 of these definitions in the file.
This works fine. However, when I do this with multiple files in the
following way:
versionCmdMap = new VersionCmdMapType;
CmdMapType* cmdmap = new CmdMapType;
#include "cmdmap1048.c"
(*versionCmdMap)[1048]=*cmdmap;
cmdmap->clear();
#include "cmdmap1049.c"
(*versionCmdMap)[1049]=*cmdmap;
cmdmap->clear();
#include "cmdmap1050.c"
(*versionCmdMap)[1050]=*cmdmap;
delete cmdmap;
}
The compiler hangs, i.e. it runs at 99% CPU load and does not stop.
Are this too many variables or what is the problem?
Any help appreciated.
Thanks in advance,
Rainer