淘客熙熙

主题:【请教】 请哪位大虾简要介绍一下STL中几种iterator -- 东方射日

共:💬3 🌺2
全看分页树展 · 主题 跟帖
家园 Not an expert... but hope this

helps:

You usually don't need to pay attention to the iterators unless you are writing generic libraries.

In the STL, iterators connect algorithms to containers, behind the scene. As suggested by their names, iterator types differ in their capability.

If what you do is writing applications, knowing the capability of containers and algorithms is more important and adequate most of time.

If you are writing libraries, say developing a new algorithm, or a new kind of container, that's another story. Because, as aforementioned, iterators enable algorithms to be used on containers generically, you'd have to know precisely how one kind of iterator is different from another to make your new algorithm or new container generic.

全看分页树展 · 主题 跟帖


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河