C++Now 2021 has ended
Back To Schedule
Wednesday, May 5 • 1:30pm - 3:00pm
Techniques for Overloading any_invocable

Log in to save this to your schedule, view media, leave feedback and see who's attending!

This talk will present techniques for overloading `any_invocable`.

`std::function` is an excellent tool for interface design. It encapsulates almost any object that is invocable the right way. `any_invocable` is an even better tool. It can encapsulate some types that `std::function` can't — the ones that are move-only. It can additionally call qualified overloads of the call operator on the underlying object. Unfortunately, it is still invocable in just one way. You get one list of argument types and that's what you must pass.

Wouldn't it be great if `any_invocable` could have as many overloads of `operator()` as you want? This talk will present techniques for implementing such a class template.

avatar for Filipp Gelman

Filipp Gelman

Software Developer, Bloomberg LP
At Bloomberg LP since 2016, Filipp enjoys exploring the obscure, arcane, and esoteric corners of the C++ language. He is known among his coworkers for heavy use of templates, emphasis on compile time computation, and abusing language features for nefarious purposes.

Wednesday May 5, 2021 1:30pm - 3:00pm MDT