Many times I saw code like this:
template<typename Collection>
void Foo(Collection&& c)
{
for (auto&& i : std::forward<Collection>(c))
// do something with i
}
For all STL containers (except vector) 'i' has type of lvalue reference. Is any practical sense to type 'auto&&' in this case?
Aucun commentaire:
Enregistrer un commentaire