Boost Users :
Subject: Re: [Boost-users] [foreach] Changes in Boost 1.47 beaking const rvalue detection for some compilers?
From: Eric Niebler (eric_at_[hidden])
Date: 2011-07-31 17:15:50
On 7/31/2011 11:04 AM, Joaquin M Lopez Munoz wrote:
> According to the discussion at
> seems like for some non-copyable sequence types, such
> as indices of Boost.MultiIndex, Boost.Foreach has stopped
> in GCC 4.6.1 with Boost 1.47 (and did not work in clang++ 2.9
> either for Boost 1.46 or Boost 1.47.)
> Before I apply the boost::foreach::is_noncopyable hack,
> can the author take a look at this? Release notes for
> Boost 1.47 indicate that const rvalue detection has
> been modified in Boost.Foreach, so I wonder whether this
> situation is something that should be fixed in
> Boost.Foreach rather than user code.
Michel Morin explains the situation here:
Compile-time const rvalue detection in Foreach in the absence of C++0x
rvalue references relies on compiler bugs. Gcc 4.6 fixes the bug. So
either you compile with -std=gnu++0x and get rvalue references, or else
you fall back on runtime const rvalue detection. In the latter case, you
have to worry about the is_noncopyable business.
So, you should specialize boost::foreach::is_noncopyable as Michel
suggests. Another option would be to make your type non-copyable by
inheriting from boost::noncopyable. Boost.Foreach is savvy to that.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
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