Chaining iterators for C++

前端 未结 7 2065
野性不改
野性不改 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条回答
  •  Happy的楠姐
    2020-12-01 12:40

    Check Views Template Library (VTL). It may not provided 'chained iterator' directly. But I think it has all the necessary tools/templates available for implementing your own 'chained iterator'.


    From the VTL Page:

    A view is a container adaptor, that provides a container interface to

    1. parts of the data or
    2. a rearrangement of the data or
    3. transformed data or
    4. a suitable combination of the data sets

    of the underlying container(s). Since views themselves provide the container interface, they can be easily combined and stacked. Because of template trickery, views can adapt their interface to the underlying container(s). More sophisticated template trickery makes this powerful feature easy to use.

    Compared with smart iterators, views are just smart iterator factories.

提交回复
热议问题