Under some situations, it seems like I can access functions that should be in the std namespace without a using
or std::
qualifier. So far, I've only seen this occur with functions from the algorithm
library.
In the following example, I expect all_of()
to be in the std namespace, but this code compiles without error in VS2013 (Microsoft Compiler 18).
#include <iostream>
#include <string>
#include <algorithm>
int main() {
const std::string text = "hey";
std::cout << all_of(begin(text),end(text),islower);
return 0;
}
Changing std::cout
to cout
without adding a using namespace std
or using std::cout
generates an "undeclared identifier" error as expected.
What's going on here?