I am currently trying to make a Transposition Table for my chess engine, and am using a class with a dynamically allocated array member of a struct object.
class TranspositionTable {
private:
TranspositionEntry* data_;
public:
TranspositionTable() {
data_ = new TranspositionEntry[5]; //5 is an example but i'm actually using a number over 16 million --
// that's why I need it dynamically allocated
}
~TranspositionTable() {
delete[] data_;
}
}
However, when the object is constructed, I check the Visual Studio debugger, and it only shows that the data_ member contains a single struct object, instead of an array of it. I am using the 'new' keyword and have tried changing whether it's a pointer or not etc. but it still doesn't work. Can anyone explain what is going on?
I just realized the problem. The array WAS actually being allocated. But since I was in the visual studio debugger, and the value was a pointer, I was actually only seeing the first value. HTHs for other people! My bad!