Overlapping functionality: IFTI, templates, is-expressions

Russell Lewis webmaster at villagersonline.com
Wed Mar 19 22:04:02 PDT 2008


Jason House wrote:
> #2 (SFINAE) I know from past discussions that C++ programmers hold this very near and
> dear to their heart.  Personally, it seems like a back door to long
> compilation times.  I don't have any problem with enforcing criteria for
> templates to be defined up front, but I'm certain others don't agree with
> me.  Does the loss of SFINAE make templates too close to generics?  I know
> C# will refuse to compile code if the up-front criteria for a generic type
> isn't specific enough.

FYI: SFINAE is "Substitution Failure Is Not An Error".  See Wikipedia.

I thought about this some more, wondering why C++ programmers would have 
come to this conclusion.  I now think it likely that they did this 
specifically because they didn't have static if() and is-expressions. 
If you don't have those two tools, then the only thing you can do is to 
run ahead into something, and hope it works...but if it doesn't work, 
you provide a more general alternative.

Is it possible that SFINAE was a hack to get around C++'s lack of 
compile-time features?  A hack that we can now dispense of?



More information about the Digitalmars-d mailing list