
On 2/3/2011 2:36 PM, Frédéric Bron wrote:
I have tried to comply with the coding guidelines for integral constant expressions (http://www.boost.org/development/int_const_guidelines.html). I have been able to comply with most of them but still have the following issue:
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.
I don't know if the following is an improvement, but... template< class T, class I = boost::integral_constant< int, boost::is_integral<T>::value >
struct foobar; template< class T > struct foobar< T, boost::integral_constant< int, 0 > > { ... }; (Alternatively, use boost::mpl::int_ (and its ilk).) - Jeff