Summary
This episode introduces C++23's std::move_only_function, a new feature designed for working with non-copyable callables. Jason demonstrates how traditional std::function requires copyable objects, forcing developers to use shared_ptr when working with unique_ptr or other move-only resources inside lambdas. In contrast, move_only_function specifically supports move-only callables, leading to simpler code and better performance by avoiding unnecessary shared ownership.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[unique.ptr]75% match -
[func.wrap.move]40% match