Chaining iterators for C++

前端 未结 7 2073
野性不改
野性不改 2020-12-01 12:24

Python\'s itertools implement a chain iterator which essentially concatenates a number of different iterators to provide everything from single iterator.

Is there so

7条回答
  •  醉话见心
    2020-12-01 12:49

    I've written one before (actually, just to chain two pairs of iterators together). It's not that hard, especially if you use boost's iterator_facade.

    Making an input iterator (which is effectively what Python's chain does) is an easy first step. Finding the correct category for an iterator chaining a combination of different iterator categories is left as an exercise for the reader ;-).

提交回复
热议问题