Click to See Complete Forum and Search --> : Help needed with STL maps!


Alan Benett
May 13th, 1999, 12:53 PM
Hi!

I'm using the STLport with VC 4.0. In most cases it works.

However I get in trouble when I try to store iterators of a map or a multimap
in another container of STL.

E.g. the two following code fragments show what I mean:

typedef map<CString, int, compare> map_str;
typedef multimap<int, map_str::iterator> map_int;

So, when I make entries in the maps, like this:

map_str smap;
map_int imap;
pair<map_str::iterator, bool> result = smap.insert (pair<CString, int> ("Some string", 123));
imap.insert (pair<int, map_str::iterator> (123, result.first);

I get an Internal-Compiler-Error when i use the function equal_range or count.
VC-Debugger points to the following line of stl_pair.h:

pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}

I also get problems when i try to create a vector of iterators...

Please help, if anybody got an idea.
Best regards.
Alan.

Paul McKenzie
May 13th, 1999, 01:34 PM
Have you tried to compile the program using another compiler that supports STL, or a newer version of VC++? With these types of problems, it's always a good thing to have two compilers. If one dies or gives a cryptic error message, you have the other to possibly clarify the problem.

Regards,

Paul McKenzie