I want to explore the changes with my vector. Thus I want to set a whatchpoint on the vector size. Thereby, Visual Studio will let me to see what is in my vector after each size change. How I can do this?
Here in this link you can find how to set a conditional breakpoint. And I tried to set a condition like this: my_vect.size() variable on Has changed
event (according to 8. Conditional breakpoints), but it sucks.
my_vect.size() is not a variable, but a function. It looks like this:
size_type size() const _NOEXCEPT
{ // return length of sequence
return (this->_Mylast - this->_Myfirst);
}
So here is the solution: start your program with the debugger. Break before the vector size changes. Add a New Data Breakpoint. Suppose your vector is called myvec
. Then in the address field type &myvec._Myfirst
and add another breakpoint with &myvec._Mylast
. Now, the debugger will stop whenever the pointers to the first or last elements in the vector change.
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