Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有可能......当调试器在断点处停止时,修改 std::string 变量的值而不诉诸诸如调整当前缓冲区的内存映像之类的技巧?
例如像“set var mystring="hello world"
?
试试这个(测试并为我工作):
call mystring.assign("hello world")
关键是你调用对象的函数来改变它的状态,而不是直接修改内存。碰巧std::basic_string有一个名为的成员函数assign来完成这项工作。
std::basic_string
assign