I am building a complex mathemathical software and I have to see while debugging some 500×700 matrixes that are created. Also the matrixes are not filled in order, meaning that “randomly” they are been filled and I need to see that. I’ve read that with the memory screen I can see the memory locations and their values, but with such huge matrixes the memory windows is not useful for me.
so my question is, is there any other way to debug adn watch matrixes in visual studio 08 than the memory window?
The method I use to visualise complex data structures is to create a
Dump()method in your class which formats the data into a string and returns astd::string. If you want to inspect the variable then select it in the debugger and invoke QuickWatch withCtrl-Alt-Qand typemyVariable.Dump(). This will then show you the string condensed into a single line. If you then click the magnifying glass icon it’ll open up a text visualiser window that can be resized.If you need more control over the format then make the
Dump()method take an int for the level of detail you require.EDIT:
Ok, here’s an example, using
stringstreamto assemble a string: [disclaimer: I haven’t tried compiling this]The Dump() method will output to a string that you can display in the QuickWatch window. If the text preview is too small then you could call DumpToFile() instead which will write the matrix to a file that you can view in a separate text editor. The key thing is that QuickWatch will evaluate function calls (to a limited degree) so you can use it to call these helper methods.