我需要在代码中的很多位置将std::vector<std::vector<T>>
转换为std::vector<T>
(逐行)。我明显知道如何自己实现它,但是在boost或stl中是否有任何短代码解决方案? (我只能使用C++ 98)展开std :: vector <std :: vector <T>>转换为std :: vector <T>
UPD:我需要一些非常短的解决方案,比如一些函数的单线调用(可能带有boost lambda),没有循环,因此C++ pushing elements of a vector of vectors into a vector的解决方案是不可接受的。
UPD2:请不要用循环发布答案,我知道该怎么做。问题是以短代码的方式,而不是想法。
[C++将向量向量推入矢量的元素的可能重复](http://stackoverflow.com/questions/18875334/c-pushing-elements-of-a-vector-of-vectors-into- a-vector) – NathanOliver
在调用之后,你仍然需要完整的载体矢量吗? – Bathsheba
我不明白如何在没有循环的情况下做到这一点。 – NathanOliver