4

There is no "using namespace std;" in the code. "find" works well. So my question is why I don't need to add "std::" to "find"?

My gcc version is 4.9.4

#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    std::vector<int> v;
    v.push_back(0);
    v.push_back(1);
    v.push_back(2);
    std::cout << find(v.begin(), v.end(), 1) - v.begin() << std::endl;
    return 0;
}
Marshall Clow
  • 15,972
  • 2
  • 29
  • 45
Maple
  • 74
  • 5

0 Answers0