相关疑难解决方法(0)

展平迭代器

是否有任何现有的迭代器实现(可能在boost中)实现某种展平迭代器?

例如:

unordered_set<vector<int> > s;

s.insert(vector<int>());
s.insert({1,2,3,4,5});
s.insert({6,7,8});
s.insert({9,10,11,12});

flattening_iterator<unordered_set<vector<int> >::iterator> it( ... ), end( ... );
for(; it != end; ++it)
{
    cout << *it << endl;
}
//would print the numbers 1 through 12
Run Code Online (Sandbox Code Playgroud)

c++ iterator std c++11

39
推荐指数
2
解决办法
5893
查看次数

标签 统计

c++ ×1

c++11 ×1

iterator ×1

std ×1