I have a couple classes, A and B, and they are used in a map with A being the key. The map is dynamically allocated (I have to do it this way) and the map is also inside of another class C, which is also dynamically allocated (I cannot change this, it's part of the SDK)
My problem is, that the content of my A class and B class is flipping positions!
To explain this, say for example this is the class definitions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
struct A
{
unsigned long Var1;
unsigned long Var2;
unsigned char Var3;
unsigned long Var4;
unsigned long Var5;
}
struct B
{
float Flt1;
float Flt2;
}
|
And these classes, as said above, are used for a map like this:
map<A, B>* MyMap;
and this map is defined in a struct, which, as said above, is also dynamically allocated.
Setting the values for all the variables is fine. But, if I try to get Var1, it gives me Var5. If I try to get Var2, it gives me Var4. If I try to get Flt1, I get Flt2. And vice versa for all of it. They seem to have switched around in memory.
Is there any reason this could happen? Even if could be anything, I would appreciate any information on this and how to fix it!!