Iterator for custom container with derived classes

前端 未结 3 1260
遥遥无期
遥遥无期 2021-01-06 05:24

I\'ve a custom container which is implemented in two different ways, but with a single interface. some thing like this.

    class Vector 
    {
       virtua         


        
3条回答
  •  北海茫月
    2021-01-06 06:00

    I faced the same problem before. I used solution #2 with slight modification in defining Iterator class

    class Iterator :public boost::iterator_facade
    {
      ...
    }
    

    This way I was able to use STL algorithms with my containers.

提交回复
热议问题