Lightning Talk: How Hard Can it be to SFINAE in C++03?
summary
Demonstrates a portable C++03 SFINAE shim that detects either an ostream operator or a void print function at compile time with no runtime overhead, using a sizeof trick to cause substitution failures, pointer-to-member return extraction to verify void returns, and recursive priority tag dispatch to force overload order. Implements manual true/false types and enable-if logic, compiles on clang, GCC, Sun Studio and xlc, and works except it doesn’t handle overloaded print functions.
AI-written summary · about
related talks
05mSFINAE: Substitution Failure Is Not An Error
55mCustom Overload Sets and Inline SFINAE for Truly Generic Interfaces
04mA Static Alternative to Virtual Functions, Using Expression SFINAE
51mTypical C++, but Why?
05mLightning Talk: The Finer Points of Parameter Packs
57mIntroduction to C++ Template Metaprogramming
51mModern techniques for keeping your code dry
54mTypical C++, But Why?
