I would like to concatenate ranges returned by function into one big range.Consider following code:
some_type_i_cant_figure_out bar() {
typedef std::vector<int>::const_iterator iter;
std::vector<int> aaa;
/* fill some data into aaa*/
some_type_i_cant_figure_out cc;
for (int i = 0; i < aaa.size(); ++i) {
std::pair<iter, iter> bbb = foo(aaa, i);
ccc = boost::join(ccc, bbb);
}
return ccc;
}
What I'm trying to achieve:
The aaa vector is huge and foo may return quite big ranges. Of course I can just create copies of all elements in range into new vector of integers and return it. It is inefficient, wasting memory and time. So I would like return one boost::joined_range. In worst case, I can live with vector of ranges, but it would be too simple and not that elegant :)
besides the joined_range isnt default constructible (which is a problematic for this example implementation) what would be the return value type? the temp variable (ccc) type and what would be the correct and elegant way to achieve the above?