As I was stepping through my program with the VS debugger, I noticed that a std::vector (which was a data member of a user-defined class) contained some nonzero values, where I expected them to be all zero - in fact the values were pretty large ( ~10^5 and random-looking ). However, when I later used std::cout to print the values to the console, they were all zero - is this unexpected behaviour normal for the debugger?
I don't know about your example, but perhaps it is the case of run configuration? When you run debbuger with Release configuration, it cannot be relied on at all, due to compiler optimizations. It should only be run with Debug config.