Boost logo

Boost Users :

Subject: Re: [Boost-users] BOOST_RESULT_OF_USE_DECLTYPE not default on C++11 compilers
From: Eric Niebler (eric_at_[hidden])
Date: 2012-01-26 02:06:41

On 1/25/2012 6:42 PM, Jeremiah Willcock wrote:
> At least on GCC 4.6 in C++0x (C++11) mode, BOOST_RESULT_OF_USE_DECLTYPE
> is not set by default, preventing classes such as
> boost::transform_iterator from working on built-in lambda expressions.
> Is there a reason that the use of decltype is not on by default for
> compilers that support it, perhaps with a flag to force emulation mode
> (like Boost.Move supports)?

It's not the default because when we made it the default, all heck broke
loose. Partly it was because of buggy libraries that returned a
different type from operator() than their nested result<> template
declared. Partly, it was due to a bug in the specification of decltype
that was only resolved in closing minutes with the adoption of N3276[*].
And partly it is because of continuing non-compliance of compilers that
don't property implement N3276.

We now have a boost feature macro for detecting this particular form of
non-compliance (BOOST_NO_DECLTYPE_N3276), so we can try conditionally
enabling decltype-based result_of again. But we'd still need to fix the
broken libraries. And let's not kid ourselves ... if it can break boost
libraries, it can break end-user code too. The potential for downstream
havoc is huge. That said, I still believe it's the right thing to do.


Eric Niebler
BoostPro Computing

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at