
29 Jul
2011
29 Jul
'11
7:36 a.m.
typedef multi_index_container< int, indexed_by< sequenced<> > > bmi_t; typedef bmi_t::nth_index<0>::type seq_idx;
const seq_idx& ret(const seq_idx& idx) { return idx; }
int main() {
bmi_t b;
seq_idx& seq = b.get<0>();
// Works BOOST_FOREACH (int i, seq) std::cout << i << std::endl;
// Doesn't compile BOOST_FOREACH (int i, ret(seq)) std::cout << i << std::endl; }
It seems that gcc attempts to copy the index, for some reason. BTW, your code compiles well with VC10.