unique_pseudofunction: N overloads for the price of 1
summary
Implements unique_pseudofunction: a move-only type-erased callable that supports multiple overloads of operator() instead of one, with a custom compile-time vtable that reduces pointer jumps to one call indirection and enables overload-resolution at call sites. Constructors use SFINAE to allow only objects callable for all requested overloads. Provides efficient conversion from larger to smaller overload-sets without extra runtime indirection and an optional small-buffer optimization to store small callables in-place.
AI-written summary · about
chapters (7)
- 0:00Introduction to unique_pseudofunction
- 2:57Motivation and limitations of std::function
- 7:32Designing the first unique_pseudofunction
- 15:50Handling move-only callables
- 23:54Supporting multiple overloads
- 32:04Small buffer optimization
- 39:17Summary and Q&A
related talks
37mC++ Zero Overhead Pass by Value Through Invocable C++ Abstractions
55mCustom Overload Sets and Inline SFINAE for Truly Generic Interfaces
15mThe Simple Essence of Overloading: Making ad-hoc polymorphism more algebraic with(…)
01h 41mC++ Type Erasure Demystified
01h 02m“Operator Overloading: History, Principles and Practice”
01h 00mC++ Function Templates: How Do They Really Work?
01h 29mHigher-order functions and function_ref
15mSealing Pointer-Based Optimizations Behind Pure Functions
