Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi-index][foreach] Iterating over a sequence index (worked in 1.46, broke in 1.47)
From: Igor R (boost.lists_at_[hidden])
Date: 2011-07-29 03:36:59


> 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net