pointer & iterator

pointer: address, use operator(*) to get/set the value

    1) support operator(+,-), move to next positon accroding to the element type it points to

    2) only should be used when mem is successive

 

 

iterator: class template, an iterator is an object of class Iter<element>

    1) we can't asign an element to it directly

    2) it stores a pointer of the elements it points to.

    3) support operator(+,-), which will change the pointer value of the element it points to, return a reference of it's self (Iter)

    4) and we can use operator(*) to get/set the value of the elements

posted @ 2017-03-09 15:19  HEIS老妖  阅读(107)  评论(0编辑  收藏  举报