I am having trouble with the Vector and HashMap classes…
I have a HashMap that uses (int, String) pairs. At one point in my program i convert the keys into a Vector:
Vector<int> densities = mMaterialZLevels.Keys();
for (int i = 0; i < densities.Size(); i++) {
URHO3D_LOGINFO("i: " + String(i) + " : " + String(densities[i]));
}
This prints out:
[Wed Sep 27 13:05:47 2017] INFO: i: 0 : 10
[Wed Sep 27 13:05:47 2017] INFO: i: 1 : 410
[Wed Sep 27 13:05:47 2017] INFO: i: 2 : 2146731646
Which is to be expected (except for the last number which i never insert as a key into the map.)
Now when I introduce a pop operation on the vector:
Vector<int> densities = mMaterialZLevels.Keys();
densities.Pop();//remove arronious big number…??for (int i = 0; i < densities.Size(); i++) {
URHO3D_LOGINFO("i: " + String(i) + " : " + String(densities[i]));
}
I get the following output:
[Wed Sep 27 13:09:23 2017] INFO: i: 0 : 10
showing only 1 element in the list while there should be 2.
This is the first time I have used the Keys() function on a HashMap. Could there be a bug there? Or am I missing something obvious?
The definition of mMaterialZLevels:
HashMap<int, String> mMaterialZLevels;
I am using Visual Studio 2017 64bit, ReleaseWithDebug configuration.
Best - Trevor.