Problem with STL map iterator

Hi,

I’m having a little trouble with the following code fragment:

map<int,int> wire_map;
map<int,int>::iterator map_iter;
// build the map, input “in_val” …
map_iter = wire_map.find(in_val);
cout <<(*map_iter).second;

When I run a function using these commands, everything is fine until I try to access the map with the iterator in the last line. I get the following error:

Error: Incorrect referencing of map_iter FILE:strawn2wireid.cpp LINE:39
Error: non class,struct,union object map_iter used with . or -> FILE:strawn2wireid.cpp LINE:39

I’ve already compiled the map with:

// map_loader.C
#include
#pragma link C++ class map<int,int>;
// End of map_loader.C

Do I need to include a line in my map_loader.C script for the iterator as well? I’m using 4.00/04. Any help would be greatly appreciated.

Cheers,
Ty

Hi,

You also need to explicitly request the dictionary for the iterators:

Cheers,
Philippe.

PS. the dictionary for map<int,int> should already be available as part of the cintdlls!