lundi 26 janvier 2015

What is std::ref useful for in this function?

Why should one prefer to call std::ref instead of not calling it at all?



template<class F, class...Ts> F for_each_arg(F f, Ts&&...a) {
return (void)initializer_list<int>{(ref(f)((Ts&&)a), 0)...}, f;
// why not return (void)initializer_list<int>{(f((Ts&&)a), 0)...}, f;
}

Aucun commentaire:

Enregistrer un commentaire