hash_map creates access violation errors
hi,
I use a hash_map for storing 4x4 DCT-Blocks. Therefore I convert each block into a string looking like:
":-88:-3:-9:-91:-44:1:-7:-93:88:-1:9:42:-2:-2:-6:". Then I use the following code to identify blocks that have been seen before.
Code:
std::hash_map<std::string, int> blockMap; //initialize hash_map
...
// add blockString to hashmap:
if (blockMap[blockString] == NULL) {
blockMap[blockString] = ++blockIDcounter;
blockID = blockIDcounter;
} else {
blockID = blockMap[blockString];
}
The blockIDcounter counts the number of different blocks.
during calculation of the first image frame, there is always a runtime error (access violation reading/writing to a certain address - its origniated somewhere in the hash_map-template) when reaching a blockIDcounter around 1800.
So, what could be the reason for this problem? I use Visual Studio C++ .NET 2003.
best regards,
Rebecca Hoffmann