Boost logo

Boost :

Subject: Re: [boost] enable_if quirk? bug?
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-11-11 13:33:26


On Sun, Nov 11, 2012 at 12:29 AM, Evgeny Panasyuk <evgeny.panasyuk_at_[hidden]
> wrote:

> 11.11.2012 11:20, Gennadiy Rozental wrote:
>
> template<typename T>
>> inline typename boost::enable_if_c<!boost::is_**float<T>::value,
>> int>::type
>> foo( T&& v );
>>
>> template<typename T>
>> inline typename boost::enable_if_c<!boost::is_**float<T>::value,
>> int>::type
>> foo( T&& v )
>> {
>> return 1;
>> }
>>
>> ...
>> foo(1);
>>
>> MSVC 10 producing this error:
>>
>
> I have just reproduced this error on MSVC2010.
> BTW, disable_if_c seems like works:
>
> template<typename T>
> inline typename boost::disable_if_c<boost::is_**float<T>::value,
> int>::type
> foo( T&& v );
>
> template<typename T>
> inline typename boost::disable_if_c<boost::is_**float<T>::value,
> int>::type
> foo( T&& v )
> {
> return 1;
> }

This is disturbing. I don't have MSVC2010, so I can't investigate, but
maybe it's the use of "!"? I know MSVC has traditionally been quirky with
integral constant expressions in template parameters. Gennadiy or Evgeny,
does

boost::enable_if_c< boost::mpl::not_< boost::is_float<T> >::value, int
>::type

work? That, or I think there's an ice_not buried in Boost.TypeTraits
somewhere.

- Jeff


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