iterator for 2d vector

前端 未结 8 997
眼角桃花
眼角桃花 2020-12-04 10:32

How to create iterator/s for 2d vector (a vector of vectors)?

8条回答
  •  被撕碎了的回忆
    2020-12-04 11:11

    Assuming you mean an STL iterator, and a custom container that implements a generic 2D array of objects, this is impossible. STL iterators support only increment and decrement (i.e. "next" an "previous") operations, where motion through a 2D set requires four such primitives (e.g. left/right/up/down, etc...). The metaphors don't match.

    What are you trying to do?

提交回复
热议问题