With this global namespace find() template function:
#include <iostream>
#include <vector>
template <typename Iterator, typename T>
Iterator find(Iterator first, Iterator last, T value) {
while(first!=last && *first!=value)
++first;
return first;
}
int main(int argc, const char * argv[]) {
std::vector<int> v = {1,3,5,7};
std::vector<int>::iterator pos = find(begin(v), end(v), 3);
if (pos != end(v))
std::cout << "Found\n";
return 0;
}
Why, the compiler (clang) fails indicating that there are two candidate template functions: my find() and the standard std::find()?