关于iterator的简单问题

UPCCPU 2004-02-23 11:25:19
#include <vector>
#include <iostream>
using namespace std;
int main( )
{
vector <int>::iterator v1_Iter;
vector <int> v1;
cout << "v1 =" ;
for ( v1_Iter = v1.begin( ) ; v1_Iter != v1.end( ) ; v1_Iter++ )
cout << " " << *v1_Iter;
cout << endl;
return 0;
}
查MSDN,iterator的定义:
template<class Category, class Type, class Distance = ptrdiff_t
class Pointer = Type*, class Reference = Type&>
struct iterator {
typedef Category iterator_category;
typedef Type value_type;
typedef Distance difference_type;
typedef Pointer pointer;
typedef Reference reference;
};
那它就是一个空结构,*v1_Iter又是什么意思呢?
...全文
47 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧