
On Fri, Apr 8, 2011 at 11:04 AM, Joel Falcou
On 08/04/11 17:05, Gennadiy Rozental wrote:
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?
- have a first level function enable_if on the highest catching metafunction then do tag dispatching inside to other function enabled_if on specialization of said initial test.
- build sensible, non overlapping traits for your cases and use these instead of raw type traits.
enable_if cant work with overlapping conditions.
This suggestion really is your best bet. To elaborate a bit further,
you don't really even want to use enable_if in this case. You really
want to write something like:
#include
::type type; };
template<typename T> struct M_impl;
template<>
struct M_impl