From Jason Turner
Watch on YouTube

Summary

This episode demonstrates how to create a simplified implementation of std::function in C++20. Jason builds a type-erased function wrapper step-by-step, explaining key concepts like pure virtual interfaces, template specialization for function signatures, and polymorphic storage. The implementation showcases why std::function has more overhead than direct function pointers or lambdas, while explaining how type erasure allows for storing arbitrary callable objects regardless of their actual type.

Resources

Tags