Boost logo

Boost :

Subject: Re: [boost] request: BOOST_NO_SFINAE_EXPR macro
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-07-31 12:43:12


Simonson, Lucanus J wrote:

>>> It would be very nice if Boost.Config provided the
>>> BOOST_NO_SFINAE_EXPR macro, that would be defined if the compiler
>>> does not support SFINAE applied to expressions.
>>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html
>>>
>>> GCC supports this feature since 4.4 both for C++03 and C++0x for
>>> example.
>> Yes, such a macro is needed
>
> So we could do this instead of use mpl and?
>
> template <typename T1, typename T2>
> enable_if_c<is_a_A<T1>::value && is_a_B<T2>::value>::type foo();

This doesn't require SFINAE extended to expressions.
This already works fine.

>> Also, it turns out that the ability to provide a default template
>> parameter for function templates markedly clarifies code using
>> enable_if. (I learned this Howard Hinnant, but I think he may have
>> gotten the idea from Peter Dimov.)
>
> This sounds interesting. Can you explain how?

I assume he refers to

template<
     typename T,
     typename Enable = typename boost::enable_if<...>::type
>
void foo(T);


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk