I tried the following:
#include <vector>
#include <algorithm>
int main ()
{
std::vector<int> myVector = {1, 2, 3, 4};
all_of(myVector.begin(), myVector.end(), [](int i){return i;});
}
expecting a compilation error as I did not put std::
in front of the all_of
function, which is a part of the standard namespace. However contrary to my expectation, the code compiled. Why is std::
not required in this case; does it have to do with using myVector
in the all_of
function?