c++templatessfinae

Is C++ (03) SFINAE aspect compiler independent?


I have a header file, whose functionality relies heavily on the success of SFINAE. In present g++ 4.6 it works as expected. Should I assume that, my code will behave seamlessly in the same way for all compilers (C++03 compilers) ?

I find this as an issue, because if something differs it won't result in compiler error and silently would change the code flow.


Solution

  • Yes, you may rely on SFINAE to exist and function properly.

    If you have a compiler that fails at it, then it's terminally non-conformant and all bets are off anyway.