How to implement an STL-style iterator and avoid common pitfalls?

后端 未结 8 786
刺人心
刺人心 2020-11-22 16:45

I made a collection for which I want to provide an STL-style, random-access iterator. I was searching around for an example implementation of an iterator but I didn\'t find

8条回答
  •  隐瞒了意图╮
    2020-11-22 17:21

    Thomas Becker wrote a useful article on the subject here.

    There was also this (perhaps simpler) approach that appeared previously on SO: How to correctly implement custom iterators and const_iterators?

提交回复
热议问题