|
Boost Users : |
Subject: Re: [Boost-users] puzzle with enable_if
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-04-15 09:03:45
Hi John,
John Dlugosz wrote:
> I'm using the Microsoft 2008 compiler.
> The template
> template <typename T, typename D>
> struct is_proper_TD_types :
> std::tr1::integral_constant<bool,
> is_Universal_time_API<T>::value &&
> (std::tr1::is_same<typename T::duration_t,D>::value ||
> std::tr1::is_same<duration,D>::value ||
> std::tr1::is_same<linear_duration,D>::value ||
> is_dimensional_time<D>::value)
> {};
> gives an error
> "'T': must be a class or namespace when followed by '::'" when T is int.
Move the integral constant type you are deriving from to the template parameter list for SFINAE to apply. In this case that'll be:
template <typename T, typename D,
typename Enable = std::tr1::integral_constant<bool, is_Universal_time_API<T>::value &&
(std::tr1::is_same<typename T::duration_t,D>::value ||
std::tr1::is_same<duration,D>::value ||
std::tr1::is_same<linear_duration,D>::value ||
is_dimensional_time<D>::value) > >
struct is_proper_TD_types : Enable {};
Please let me know if this works for you.
HTH,
Gevorg
P.S.
BTW, has my suggestion in the thread "Choosing a variable size" worked for you?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net