"SFINAE is Evil"

Jason House jason.james.house at gmail.com
Fri Mar 21 20:17:30 PDT 2008


I should probably expand this question...

Who uses templates in D? What is the most complex use you've done? Do you ever plan to get more complex? Would SFINAE make your life easier or harder?

I've written templates classes that have one definition, and used static if as needed for specialization. I don't forsee more complex usage and view SFINAE as something that would mask bugs.



Jason House Wrote:

> 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