Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-11-21 17:12:05

> I just ran into a problem caused by the TR1-ization of the type traits
> library. I had a function defined this way:
> template <class T>
> typename is_fundamental<T>::type f(T)
> {
> return mpl::bool_< is_fundamental<T>::value >();
> }
> that wouldn't compile. Eventually I discovered that it was because
> type traits now yield instances of integral_constant<T,N> (is that
> documented somewhere now?)


> integral_constant<T,N> is derived from mpl::integral_c<T,N>, but
> mpl::bool_<N> is not derived from integral_constant<T,N>. I can
> understand not wanting to introduce that sort of two-way coupling
> between the libraries, but it also seems like the only way to make
> everything work smoothly.

integral_constant<bool,b> derives from mpl::bool_<b> for backwards

Stupid question but why doesn't your function do:

template <class T>
typename is_fundamental<T>::type f(T)
    return is_fundamental<T>::type();


Boost list run by bdawes at, gregod at, cpdaniel at, john at