Boost logo

Boost Users :

From: james.jones_at_[hidden]
Date: 2007-03-07 11:21:27


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 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