From: Oliver Regenfelder on
Hello,

Adam wrote:
> It is not my production code, it's just a code snippet to reproduce
> actual behaviour. Now I have even simpler one :
>
> typedef stdext::hash_map<int,int> MAP;
>
> I found that when I add one element everything is ok :
>
> CArray<MAP> test;
> MAP item;
> test.Add( item );
> test.RemoveAll(); // this is ok !
>
> But when I add two or more elements I get access violation
>
> CArray<MAP> test;
> MAP item;
> test.Add( item );
> test.Add( item );
> test.RemoveAll(); // unexpectable access violation !

Maybe this should be changed anyway, because (also in your
original code) you are making a copy of the hash_map on
insertion AND on any retreival. So in case the hash_map
has more elements it might be better in any case to have
the CArray only store pointers ?!

Best regards,

Oliver