2 ms·
> What's even going on there? The first line defines 'struct overloaded' derived from all of its template parameters. Template parameters are supposed to be f
by alexeiz 8y ago
> What's even going on there?
The first line defines 'struct overloaded' derived from all of its template parameters. Template parameters are supposed to be functors (lambdas), so we use their operator()'s in 'overloaded'.
The second line defines a template deduction guide for the 'overloaded' constructor, which says: take types from the constructor arguments and use them as the class template parameters.
The idea is to be able to construct 'overloaded' like this:
overloaded{[](ArgT1 arg){/*lambda1*/},
[](ArgT2 arg){/*lambda2*/}, ...};