I have a two dimensional vector at which I want to break if the height does not equal the width.
I thought of a condition like this my_vector.size() != my_vector[0].size()
but when I tried this I got the error "This expression has side effects and will not be evaluated".
I saw the answer to this question and tried to use _Mylast
and _Myfirst
but then I got the error "The breakpoint cannot be set. a pointer to a bound function may only be used to call the function".
What else can I do to get the size of a vector in a breakpoint condition?
Asked
Active
Viewed 614 times
1
-
1Instead of a conditional breakpoint (which are quite slow, so this trick also works for code run in tight loop), just insert an if statement in the code: `if (my_vector.size() != my_vector[0].size()) { __debugbreak(); }`. – Aidiakapi May 28 '17 at 18:01
1 Answers
0
Since the question hasn't received a more elaborate answer yet, I'll post my comment as an answer.
Instead of trying to use a condition breakpoint, you can modify the source code, to call into the debugger itself:
if (my_vector.size() != my_vector[0].size())
{
__debugbreak();
}
This is also useful for a tight loop, because a conditional breakpoint is very slow, whereas this technique has minimal overhead.

Aidiakapi
- 6,034
- 4
- 33
- 62