Boost logo

Boost :

Subject: Re: [boost] [type_traits] extension has_operator_xxx - conforming to coding guidelines for ICE
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-02-03 18:02:55


Frédéric Bron wrote:
>
>> Don't use dependent default parameters for non-type template parameters.
>> For example:
>>
>> template <class T, int I = ::boost::is_integral<T>::value> // Error
>> can't deduce value of I in some cases.
>> struct foobar;
>>
>> Rationale: this kind of usage fails for Borland C++. Note that this is
>> only an issue where the default value is dependent upon a previous
>> template parameter, for example the following is fine:
>
> Is there any known workaround for this? In my case, int is replaced by
> bool but I think it is the same issue.
>
>

Hi,

you could try to add an indirection.

template <class T, bool B>
struct foobar_aux;

template <class T>
struct foobar : foobar_aux<T, ::boost::is_integral<T>::value> {};

HTH,
Vicente

-- 
View this message in context: http://boost.2283326.n4.nabble.com/type-traits-extension-has-operator-xxx-conforming-to-coding-guidelines-for-ICE-tp3259138p3259173.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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