Writing an iterator that makes several containers look as one

前端 未结 6 433
遇见更好的自我
遇见更好的自我 2020-12-16 12:12

Consider the following simplified example and desired output:

class A
{
    class combined_iterator
    {
        ????
    }
    typedef ??? t_combined_it;

         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 12:46

    The answers other people gave only work for joining two ranges, but not an arbitrary number of range.

    PStade Oven has a concatenated adaptor for joining any number of ranges; it also has a jointed adaptor for joining 2 ranges, specifically.

    You can of course turn the ranges into iterators with begin() and end() if necessary; just make sure the ranges outlast the iterators.

提交回复
热议问题