I hit a wall while debuging my C++ class. It's a graph of sorts, something like this:
class Graph {
class Node {
std::map<int, Node>::iterator _neighbors[4];
};
std::map<int, Node> _map;
};
Basically, each node keeps track of exactly 4 neighbors by storing iterators to them in the containing class' map.
The problem is that when I go to display the contents of _map in VS2008 during debugging, I get something like this:
- _map
- [0]
first
- second
- _neighbors
- _ptr
first
- second
- _neighbors
- _ptr
first
- second
- _neighbors
...
Apparently, instead of listing the 4 neighbors of the Node with index 0 in the map, it lists its first neighbor, then the first neighbor's first neighbor, then its first neighbor and so on ad infinity. Also, at no point does _neighbors
appear as an array, even though it is declared as such.
I found an add-on called VSEDebug that supposedly has enhanced STL display, but it's for VS2k3 and I couldn't get it to work in 2k8 (neither the binaries, nor compiling it myself).
The immediate window isn't much help either, as trying to call _map.operator[]
returns with CXX0058: Error: overloaded operator not found
.
Any ideas how I can get a meaningful display of the contents of my map? Note that I'm fairly new to VS as a whole, so I'll probably need detailed instructions. :)