Consider the following code:
#include <algorithm>
int main() {
std::vector<int> v = {1,2,3};
max_element(v.begin(), v.end());
return 0;
}
This compiles fine with gcc 7.2.0 and clang++ 3.9.1. I'd expect that I need to write std::max_element
, but it seems that at least some functions in <algorithm>
are in the global namespace - opposed to the draft of the C++17 standard, which shows the functions living in namespace std.
What is going on here?