标题:vector::const_iterator
只看楼主
独孤剑魔
Rank: 1
等 级:新手上路
帖 子:103
专家分:0
注 册:2008-8-5
 问题点数:0 回复次数:2 
vector::const_iterator
#include<iostream>
#include<vector>
using namespace std;
void main()
{
    vector<string> text(10,"abc");
    for(vector<string>::const_iterator iter = text.begin();iter!=text.end();iter++)
    {
        cout<<*iter<<endl;
    }
}

编译无法通过
--------------------Configuration: fafafad - Win32 Debug--------------------
Compiling...
fafa.cpp
D:\c++\fafafad\fafa.cpp(9) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conv
ersion)
Error executing cl.exe.

fafafad.exe - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: vector const iterator text std 
2008-08-09 10:21
xlh5225
Rank: 2
等 级:论坛游民
威 望:2
帖 子:188
专家分:25
注 册:2007-8-14
得分:0 
加一个头文件:#include<string>
2008-08-09 10:25
独孤剑魔
Rank: 1
等 级:新手上路
帖 子:103
专家分:0
注 册:2008-8-5
得分:0 
感谢!
2008-08-09 10:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-227388-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.544222 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved