Map memory corruption in template style function call

I have a strange memory corruption to a std::map when using the std::map.find function and was hoping to get some advice. I am using 64-bit windows XP and compiling my code with ICL to generate 64-bit DLLs.

Code snippet:

my_instance_ptr has a member std::map my_map <std::string, My_Obj_Type *>.

my_instance_ptr->get ("name") leads to a function call to my_map.find ("name"). This my_map.find call works correctly and results a NIL since the map is empty.

I subsequently (in the very next line) call a function
my_instance_ptr->register <MyType> ("name") leads to a function call to my_map.find ("name"). This my_map.find call throws an exception while searching through the tree even though the map is empty.

The difference between the prototype "get" and "register" is

My_Obj_Type * get (std::string name_spec);

template <typename type>
My_Obj_Type *
register (std::string name_spec = "", int temp = 0);

I did try to remove the default arguments from the register function but that did not change the behavior and the my_map.find still throws an exception. I appreciate any comments/suggestions that you may have.

Thanks,
AD

Last edited on
It's always best to post some code that reproduces the problem. A written description often doesn't always match the code.
Topic archived. No new replies allowed.