Sean Parent published via Twitter the following code :
template <class F, class... Args>
void for_each_argument(F f, Args&&... args) {
[](...){}((f(std::forward<Args>(args)), 0)...);
}
Even though it initially looks like calling f inside a lambda for every (variadic number of) argument, we see that the call is being made after the lambda closing brace.
- Does anyone care to explain this code ?
- Is the
...allowed as lambda argument ? (I'm pretty sure this wasn't available in c++11)
Aucun commentaire:
Enregistrer un commentaire