Iterator action, the difference between the pointer and

Iterator

iterator pattern is to use a model of the aggregate object, it is possible without knowing the internal representation of the object, each element in a certain order.

Generally used only for the underlying polymeric support classes, list, vector, stack, ostream like.

And pointer difference?

Iterator is not a pointer, a class template, acting like pointer.

Mimics some of the function pointers, some overloaded operators pointer.

Essentially encapsulates the native pointer is a pointer to enhance the concept (lift), provides more advanced than the pointer behavior, the equivalent of an intelligent pointer.

Iterator returns an object reference value is not an object, so the output iterator cout can only use the value * value can not be directly output itself.

 

Guess you like

Origin www.cnblogs.com/pacino12134/p/11258977.html