$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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.