泛型编程 --迭代器

1:矢量或列表使用迭代器

for (auto pr = scores.begin();pr != scores.end();pr++)

  cout  << *pr;

for (auto x : scores)

  cout << x <<endl;

2:迭代器类型

1)输入迭代器

  单向迭代器,可以递增,不能倒退

2)输出迭代器

3)正向迭代器

4)双向迭代器

5)随机访问迭代器

posted @ 2020-04-26 19:37  糖糖_彭  阅读(122)  评论(0编辑  收藏  举报