3 ms·
> If you need to keep that pointer in a collection, or in a class member, or pass as a function argument, “auto” won’t work. Trivially solved with decltype, no
by kllrnohj 10y ago
> If you need to keep that pointer in a collection, or in a class member, or pass as a function argument, “auto” won’t work.
Trivially solved with decltype, no need to remember anything.
decltype(std::mem_fn(&Foo::Whatever))
Typedef it if you want.
> And std::function introduce some performance overhead.
It's the same performance as a virtual function call. Pretty much the same as a function pointer invoke.