0

std::find_if's UnaryPredicate is by value. Why cannot we have it by universal reference? i.e.

template< class InputIt, class UnaryPredicate >
InputIt find_if( InputIt first, InputIt last, 
                 UnaryPredicate&& p );

Is it mostly for historical reasons, or is there reason to prefer pass by value over universal reference in this case even with c++11?

Related questions: Passing functor object by value vs by reference (C++), Why does std::find_if(first, last, p) not take predicate by reference?

Jarod42
  • 203,559
  • 14
  • 181
  • 302
bill
  • 650
  • 8
  • 17

0 Answers0