Iterators in C++ (stl) vs Java, is there a conceptual difference?

前端 未结 9 947
夕颜
夕颜 2020-12-13 09:30

I\'m returning to c++ after being away for a bit and trying to dust off the old melon.

In Java Iterator is an interface to a container having methods: hasNext

9条回答
  •  醉梦人生
    2020-12-13 10:08

    Iterators are only equivalent to pointers in the trivial case of iterating over the contents of an array in sequence. An iterator could be supplying objects from any number of other sources: from a database, from a file, from the network, from some other calculation, etc.

提交回复
热议问题