"SFINAE is Evil"

Jason House jason.james.house at gmail.com
Thu Mar 20 19:36:14 PDT 2008


SFINAE - Substitution failure is not an error

This post is all about templates and their static if counterparts.  With the
enhanced expressiveness of D, is there a need for SFINAE from C++? 
Essentially, when a specialization exists, if the compilation of the
specialization fails, the compiler silently gives up on it and goes to the
next more general case.  In my mind, this is both dangerous and a loop hole
for long compile times (as the compiler instantiates extra template
instances).

What I want to know is this:  Who uses SFINAE in D, and why?  Is this a
matter of convenience or a requirement.  If required, I assume it's from a
lack of expressiveness in defining a template's conditions.  Could this be
overcome with use of static if's instead?

PS: Post title is a quote of Russell Lewis from another thread.



More information about the Digitalmars-d mailing list