Iterator for custom container with derived classes

前端 未结 3 1281
遥遥无期
遥遥无期 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:13

    A possibility is to use a template class for your container, with the private data-container as parameter. This way, the iterator can be defined in the class independent of the data-container.
    I'm just not sure whether this is "unified" enough for what you need.

提交回复
热议问题