Boost logo

Boost Users :

Subject: Re: [Boost-users] enable_if and multiple partial specializations
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2011-04-08 11:05:45


Joel Falcou <joel.falcou <at> lri.fr> writes:

> template<class T>
> struct M<T,typename boost::enable_if< boost::is_enum<T> >::type> {
> static void foo() { std::cout<< "enum"<< std::endl; }
> };
>
> template<typename T>
> struct M<T, typename boost::enable_if_c< boost::is_scalar<T>::value &&
> !boost::is_enum<T>::value >::type> {
> static void foo() { std::cout<< "scalar"<< std::endl; }
> };
>

This will not really work for me. This was just an artificial example. In
reality I have generic header which defines the template, another common header
which defines some not very specific specialization and multiple (number changes
as project grows) headers where I define more specific specializations. I can't
"NOT" all the specific conditions in "scalar" level specialization - It's just
not maintainable.

Any other options?

Thank you,
Gennadiy


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