jeudi 14 mai 2015

Why do the major STL std::algorithm implementations still take predicates/functors by value?

Based on my understanding of universal references, template functions should take all their template-dependent arguments by &&. There's no down side and plenty of advantages. However, libc++, libstdc++, and MSVC 2013's std::algorithm implementations all pass their predicate/comparator/functor arguments by value.

Is there a reason for doing so? I'm writing my own STL-like algorithms, but I'm more interested in doing the right thing than copying existing conventions.

Aucun commentaire:

Enregistrer un commentaire