A Soupçon of SFINAE
summary
A compact cookbook of concrete SFINAE recipes showing what compiles and what breaks: using void_t trick and decltype(declval()) for expression SFINAE to implement add_lvalue_reference, is_assignable and is_static_castable; turning constructors into templates and stalling evaluation with an extra bool parameter to disable default constructors; using bool_if_t indirection and priority_tag to make mutually exclusive or ordered overloads; a pointer_traits pointer_to fix that first compiles but initially causes a segfault until the parameter/ref logic is corrected.
AI-written summary · about
chapters (22)
- 0:00Intro
- 0:26Outline
- 1:58WYOTT: true_type and false_type
- 4:01WYOTT: partial specialization
- 6:37WYOTT: trouble looms
- 9:01Introducing SFINAE
- 13:46void_t is a tool for mass production
- 15:06WYOTT: declval
- 16:55Expression SFINAE
- 20:47WYOTT: conditional_t
- 21:25WYOTT: enable_if_t
- 24:24Motivation: Polymorphic memory resources
- 25:25Fancy-pointer all the things!
- 29:29Explanation and solution
- 32:33Improve the error message
- 35:24Motivation: EXPLICIT constructors
- 39:01The wrong fix
- 41:51Lesson 2
- 42:32Motivation: pointer_traits
- 54:04Hierarchical tag dispatch
- 56:01Make up the hierarchy from outside
- 57:47Sometimes we must make up the hierarchy
related talks
55mCustom Overload Sets and Inline SFINAE for Truly Generic Interfaces
04mWhen the Compiler Gives You Errors, Make SFINAE
53mThe Detection Idiom - a simpler way to SFINAE
06mReasoning with function signatures
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
42mC++ Horizons
01h 28mC++ Concepts "Lite" in Practice
01h 27mC++20 Templates - the Next Level: Concepts and More
