关于C ++中的字符串的问题 [英] a question about string in C++

查看:94
本文介绍了关于C ++中的字符串的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string s ="123456";
调试代码时,我在监视表中看不到s [0]的值.
相反,它显示了"CXX0058:error:未找到重载运算符"
s [0]不应该为"1"吗?

string s="123456";
I can not see the value of s[0] in the watch table when I debug my code.
Instead, it shows me"CXX0058 :error:overload operator not found"
shouldn''t s[0] be ''1''?

推荐答案

这是由于调试器对重载运算符的限制.您会发现与vector<>等其他类型相同.
It''s due to a debugger restriction with overloaded operators. You''ll find the same with other types like vector<>.


您可以尝试使用内存窗口.将指针指向字符串缓冲区.
You can try memory window. Put there pointer to string buffer.


您必须创建一个字符串缓冲区
就像
StringBuffer sb = new StringBuffer(s);
you have to create a string buffer
just like
StringBuffer sb=new StringBuffer(s);


这篇关于关于C ++中的字符串的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆