Defining iterator of my own container

前端 未结 3 1963
时光说笑
时光说笑 2021-01-02 02:47

I am confused with some concepts about defining my own iterator:

From this: http://www.cs.northwestern.edu/~riesbeck/programming/c++/stl-iterator-define.html, which

3条回答
  •  礼貌的吻别
    2021-01-02 03:26

    Although using std::iterator may help with typedefs, it certainly doesn't help with the actual implementation.

    The Boost.Iterator library has lots of good things for this, and I'll suggest to read about the boost::iterator_adaptor which greatly reduce the amount of code you need to type to define a new iterator on top of an old one.

提交回复
热议问题