惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
SecWiki News
SecWiki News
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 司徒正美
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
腾讯CDC
Scott Helme
Scott Helme
I
InfoQ
Cyberwarzone
Cyberwarzone
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Latest
Security Latest
The Register - Security
The Register - Security
Project Zero
Project Zero
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
C
Cisco Blogs
L
LINUX DO - 热门话题
P
Privacy International News Feed
IT之家
IT之家
U
Unit 42
P
Privacy & Cybersecurity Law Blog
H
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Palo Alto Networks Blog
F
Full Disclosure
宝玉的分享
宝玉的分享
Simon Willison's Weblog
Simon Willison's Weblog
L
Lohrmann on Cybersecurity
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Recent Announcements
Recent Announcements
Forbes - Security
Forbes - Security
Cisco Talos Blog
Cisco Talos Blog

博客园 - JieNet

MFC中的数据类型 HardwareSerialNumber(硬盘号,CPU号) - JieNet - 博客园 Windows 7 与 XP、Vista 特性对照表 typename 还是超级无敌的基础。。。 函数指针。。。超级无敌的基础了 可变参数的基本应用 关于const和函数 - JieNet - 博客园 委托与事件 .NET中的加密解密:私钥加密(对称加密):AES、DES、RC2、Rijindael、TripleDES 事件 ID: 5603 将DAL层从Sql Server 迁移到 Access 时遇到的问题 ListView:How to.... CSS剪切图片 SQL Server TransAction 全部回滚 所有希腊字母及读音 Error:'Sys' is undefined. VS2008 下安装 AjaxControlToolkit-Framework3.5 JS,CSS 禁止复制,禁止打印,禁止…… ADSL拨号错误代码详解
iterator类对象和普通指针
JieNet · 2009-06-02 · via 博客园 - JieNet

#include<iostream>
#include
<vector>
#include
<iterator>
#include
<string>
using namespace std;
int main()
{
vector
<string>vec;
string str1("aaa"),str2("bbb"),*p;
vector
<string>::iterator it;
vec.insert(vec.begin(),str1);
vec.insert(vec.end(),str2);
for(it=vec.begin();it<vec.end();it++)
cout
<<*it<<endl;
cout
<<endl;
for(p=vec.begin();p<vec.end();p++)
cout
<<*p<<endl;
return 0;
}

迭代器是广义指针,而指针满足所有迭代器要求。迭代器是STL算法的接口,而指针是迭代器,因此STL算法可以使用指针来对基于指针的非STL容器进行操作。
iterator 是一个 class, p 是一个指针,不要随便把 class 和指针混淆起来。

至于上面的例子,有的IDE能够通过编译(VC++6),有的不行(VC++.NET2003),只能说是实现对C++标准的支持的所不同的原因!

关于这个还要多谢很多大哥的指点!在此谢过!