Summary
This episode explains the differences between std::invoke and std::apply, two powerful standard library utilities for calling functions. Jason demonstrates how std::invoke allows calling any callable (functions, member functions, lambdas) with individual arguments, while std::apply is designed to work with tuple-like objects by unpacking their elements as arguments. The episode also explores a simplified implementation of std::apply using template metaprogramming, showing how it utilizes index sequences to extract elements from tuples at compile time.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[func.invoke]40% match -
[tuple]40% match -
[tuple.apply]40% match