I have just came across the fact that several algorithms from standard algorithm
header do not require std::
.
Example:
#include <vector>
#include <algorithm>
int main() {
std::vector<int> m;
count(m.begin(), m.end(), 0);
count_if(m.begin(), m.end(), [](auto){return true;});
for_each(m.begin(), m.end(), [](auto){});
find_if(m.begin(), m.end(), [](auto){return true;});
}
Is there any specific reason for that? Both g++
and clang++
accept the code above.