Is there any technique that would let one put a vector element in a watch window, and actually see it update when it changes?
This is the context.
vector<int> x;
x.push_back(3);
Then put x[0] into the watch window and actually see its value.
Failing a solution to that issue, what is the best alternative?
Add x
to a watch window. VS should display its elements. Click on the plus link to the left to see its elements each in its own row. Click on the name of the element (i.e. x[0]
) and drag it into its own blank row in the watch window. That should give you a new row watching the element you wanted. Make sure what you click on for dragging is the variable name and not its value (dragging the value will watch the value).
Pablo's method works for only fixed index values. If you want to set the index using a variable use:
((x)._Myfirst)[index]
It is ugly and hard to remember but does the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With