Actually the question is how to achieve it? The use of boost::any_range is possible but undesirable (performance considerations)
Sample code:
typedef boost::multi_index_container<
int, bmi::indexed_by>> Datum;
class bar {
public:
auto foo() const;
private:
Datum m_someDataContainer;
};
SomeType bar::foo() const {
SomeType retVal;
for (auto i = 0u; i < 10; ++i) {
retVal = boost::range::join(retVal, m_someDataContainer.equal_range(i));
}
return retVal;
}
Here we can observe several problems. The return type cannot be easily deduced. The join would create joined_range VersionRange;
but above will create nested joined_range of any_range which, when the number of iterations is big enough, has tremendous impact on performance.
So, what can be done here?