What are Iterators, C++?

前端 未结 5 396
孤城傲影
孤城傲影 2020-12-16 12:09

What are Iterators in C++?

5条回答
  •  一生所求
    2020-12-16 12:52

    Iterators are a way of traversing a collection of objects. Typically, they allow you to access an STL (Standard Template Library) container sequentially in ways similar to accessing a classical C array with a pointer. To access an object through an iterator, you dereference it like a C pointer. To access the next object in a collection, you use the increment (++) operator. Some containers have multiple kinds of iterators that allow you to traverse the collection in different ways.

提交回复
热议问题