A Soupçon of SFINAE
Play A Soupçon of SFINAE
Following on Arthur's "Template Normal Programming" from CppCon 2016, this will be a concise cookbook of SFINAE recipes — ways of getting the compiler to do one thing in one circumstance and another thing in another circumstance. The recipes presented will include: - Partial specialization of struct templates - std::bool_constant - std::conditional_t - Expression SFINAE on return types (using decltype) - Expression SFINAE in a defaulted template type parameter - std::enable_if_t as a defaulted template type parameter - Tag dispatch on std::true_type and std::false_type - "Meta-tag-dispatch" on true and false as template non-type parameters - priority_tag＜N＞ for tag dispatch with "fallback" cases - bool_if_t as a template non-type parameter In each case, we'll show a real code example where the recipe is the clearest and best way to get the job done. This will draw on Arthur's recent "STL From Scratch".