Although the debugger of VC 7 (.NET 2003) is already very good, it is still a bit inadequate place.
We usually use the containers in some standard libraries to store data, such as Vector, we want to see data in container in the process of debugging, so that there are bugs in those places.
However, the debugger still does not smart to view the data in the standard library container when commissioning. Of course, this requirement of the debugger to identify the data structure of the standard library, and this requirement seems to be more excessive, and some time us will also Use other libraries or write containers, such as Matrix matrices, there is no in the standard library.
So the only possible way is to implement a stream output (Operator <<) for the class of the container, and then insert some debug statements in the program, output the value of the container to std :: cout or other output stream (text stream, etc.) . After the quotation is completed, then remove it or comment. You can also pack it with a pair of preprocessing statements, then the Release version will be automatically removed.
#ifdef _debug std :: cout << var_name << std :: endl; #endif
Because every time you write such a statement, you have written a small function and a macro to replace such a job, and you can add more debug information.
The following function adds the function name, variable type (requires support for RTTI runtime type identification), and the name of the variable.
static std :: ofstream __ry_debug ( "../ ry_debug.log"); template