Assume that type T
and length size
is known,
how to display array data
in debugger gracefully?
template<class T>class Container{
void* data; //<-- display it!
int size;
}
In watch windows (Visual studio 2015), I can display container.data
by typing:-
static_cast<T*>(container.data),size
Question: Are they any technique (especially modify code in Container
) to make this process to be automatic and elegant - like std::vector?
In other words, it would be nice if I can just type container
, then the watch will show :-
container
+data (the + button, can click to expand)
--data[0] (expanded)
--data[1]
......
--data[size-1]
My best clue is to use union
, but I am not sure.