Boost logo

Boost Users :

From: Eelis van der Weegen (boost-users_at_[hidden])
Date: 2005-03-02 14:22:49


I'm having trouble using BOOST_FOREACH to iterate over Boost.MultiIndex
containers. I've attached a testcase, which fails to compile because of what
looks like an ADL collision between range_iterator's end() and boost::mpl::end.

I'm using GCC 3.4.2 with foreach.hpp revision 1.22 from the sandbox. Others have
reported that GCC 4.0.0 20050130 is also affected.

(I'm aware that BOOST_FOREACH isn't part of Boost yet, but it's in the review
queue so I thought posting this here was appropriate.)

Regards,

Eelis


#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/foreach.hpp>

namespace mi = boost::multi_index;

typedef boost::multi_index_container<int, mi::indexed_by<mi::sequenced<> > > C;

void f (C const & c)
{
  for (C::const_iterator i = c.begin(); i != c.end(); ++i) { int r = *i; } // ok

  BOOST_FOREACH(int r, c) {} // errors
}


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