简体   繁体   中英

Setting a data breakpoint on an element of a std::map

I have a std::map which is a private member of a class. One of it's values is being changed (when it shouldn't) and I can't figure out where. Once the map is assembled, the element in question is always going to be the last, due to the nature of the keys being used.

I'm trying to set a data breakpoint on the last element (the sixth one to be precise) in Visual Studio 2010 but am having no luck. I've looked through the header of both map and xtree (its base) and can't find a suitable member to use.

Does anyone know how to set a data breakpoint on the value of an element in a std::map ?

You should be able to use the debugger to browse through the map to the actual .second data member, and then tack an & in front of the expression it generated. Then put that address into the data breakpoint and see if you have better luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM