I got this example from cpp reference: https://en.cppreference.com/w/cpp/algorithm/find:
std::vector<int> v{1, 2, 3, 4};
auto result2 = std::find(begin(v), end(v), 2);
My first intent would have to be that both arguments begin(v) and end(v) must have the namespace specifier prefixed: std::begin(v)
and std::end(v)
. But apparently according to the example it is also possible to leave this out. Why can I do this, in which situations can I do this and what C++ standard does this feature ship with?