由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 一个C++的概念问题
相关主题
呼唤大侠们,我实在不能实现C++泛型的精神。stl container erase in a loop
c++ template question:再问两个C++问题
c++ pointers are iterators, why?C++ template function一个问题
关于inserterreturn Triangular_iterator( _beg_pos );意思
how to write a function take iterators as parameters?怎么传container的单个地址吗?
stl的一个问题stl 的 member type 看起来挺头大的
C++ vector 一边遍历一边删c++ interview: iterator 和 pointer区别?
deque的pointer和reference是怎么回事?C++ Q11: iterator
相关话题的讨论汇总
话题: iterator话题: vector话题: access话题: map话题: iterators
进入Programming版参与讨论
1 (共1页)
t*i
发帖数: 72
1
How to iterator through a vector, list and map? What is the difference among
them?
到底有啥区别么?
O*******d
发帖数: 20343
2
You can use index to access members of a vector as if it is an array. You
can use key to access members of a map.
You can use iterator to access members of all three of them.
index and key are fast, while iterator is slow.
t****t
发帖数: 6806
3
the good thing about iterator is that, you have consistent interface(s) to
iterate through a container, be it sequential or associative. you may even
access something that is not a container via iterator and adaptor, e.g.
ostream_iterator.
for difference, vector,list and map iterators are all bidirectional
iterators. vector::iterator is random in addition, however.

among

【在 t*i 的大作中提到】
: How to iterator through a vector, list and map? What is the difference among
: them?
: 到底有啥区别么?

t*i
发帖数: 72
4
Thank you so much.

【在 O*******d 的大作中提到】
: You can use index to access members of a vector as if it is an array. You
: can use key to access members of a map.
: You can use iterator to access members of all three of them.
: index and key are fast, while iterator is slow.

t*i
发帖数: 72
5
Thank you so much

【在 t****t 的大作中提到】
: the good thing about iterator is that, you have consistent interface(s) to
: iterate through a container, be it sequential or associative. you may even
: access something that is not a container via iterator and adaptor, e.g.
: ostream_iterator.
: for difference, vector,list and map iterators are all bidirectional
: iterators. vector::iterator is random in addition, however.
:
: among

1 (共1页)
进入Programming版参与讨论
相关主题
C++ Q11: iteratorhow to write a function take iterators as parameters?
C++ syntax questionstl的一个问题
C++ 菜鸟问一个关于template 的问题。C++ vector 一边遍历一边删
问一个C++ set和unordered_set iterator的问题deque的pointer和reference是怎么回事?
呼唤大侠们,我实在不能实现C++泛型的精神。stl container erase in a loop
c++ template question:再问两个C++问题
c++ pointers are iterators, why?C++ template function一个问题
关于inserterreturn Triangular_iterator( _beg_pos );意思
相关话题的讨论汇总
话题: iterator话题: vector话题: access话题: map话题: iterators