#include<list>
#include<iostream>
using namespace std;
int main()
{
list<string> name1;
name1.insert(name1.begin(),"1st");
name1.insert(name1.end(),"2nd");
name1.insert(name1.end(),"3rd");
list<string>::iterator to;
to=name1.begin();
while(to!=name1.end())
{
cout<<*to<<endl;
to++;
}
name1.~list();
return 0;
}
调试时出现error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable
conversion),请问怎么解决?
c++list的输出问题
答案:1 悬赏:40 手机版
解决时间 2021-01-30 12:49
- 提问者网友:谁的错
- 2021-01-30 07:03
最佳答案
- 五星知识达人网友:话散在刀尖上
- 2021-01-30 07:40
#include <string>
还有 name1.~list(); 这是何必呢 你调用一次 推出函数还要自动调用一次 自己折腾自己嘛
还有 name1.~list(); 这是何必呢 你调用一次 推出函数还要自动调用一次 自己折腾自己嘛
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯