|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-03-07 11:47:02
Sorry,
I ment enable_if< is_decimal_type<T> >::type. The ::type will be expanded to
either void or a derivable type.
Ovanes.
-----Original Message-----
From: Ovanes Markarian [mailto:om_boost_at_[hidden]]
Sent: Mittwoch, 7. März 2007 17:43
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [enable_if] using enable_if
toextendstd::numeric_limits?
Hi!
I think you need to derive your class from enable_if< is_decimal_type<T> >.
If your compiler supports SFINAE and is_decimal_type<T>::value is false_
template will be derived from void which is not legal...
Best Regards,
Ovanes
-----Original Message-----
From: james.jones_at_[hidden] [mailto:james.jones_at_[hidden]]
Sent: Mittwoch, 7. März 2007 17:21
To: boost-users_at_[hidden]
Subject: [Boost-users] [enable_if] using enable_if to
extendstd::numeric_limits?
Suppose I have a set of templates that have a common interface (each is a
model of the same concept, to use that lingo). I'd like to extend
std::numeric_limits to support this concept. I'm trying to find a way to use
enable_if to do this, but I don't see how. Is this possible? Is there some
other trick to doing this?
Example with code (not real code):
template< class U, class V >
class model1;
tempalte< class U, class V >
class model2;
template< class U >
is_decimal_type { static const bool value = false; };
template< class U, class V >
is_decimal_type < model1<U, V> > { static const bool value = true; };
template< class U, class V >
is_decimal_type < model2<U, V> > { static const bool value = true; };
Would like to do this:
template< class T >
class numeric_limits< T >
{
// extensions go here
};
But only if is_decimal_type<T>::value is true (so that the partial
specialization only applies to my concept).
Thanks,
-
James Jones Administrative Data Mgmt.
Webmaster 375 Raritan Center Pkwy, Suite A
Data Architect Edison, NJ 08837
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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