Why is there no overload for std::for_each, or any other std::algorithm functions of similar form like:
template<class Container, class UnaryFunction>
UnaryFunction for_each(Container c, UnaryFunction f);
that would basically just do:
template<class Contianer, class UnaryFunction>
UnaryFunction for_each(Container c, UnaryFunction f){
return std::for_each(c.begin(), c.end(), f);
}
It seems to me that I am often using these types of functions on the entire range of a container, and it seems inconvenient, especially with long container names, to type:
std::for_each(myLongContainerNameThatIsLong.begin(), myLongContainerNameThatIsLong.end(), f);
Is there any detail I'm missing that prevents this, or some mechanism to get the signature I want?