0

I have run into a few circumstances in C++ 11 where it seems like the "std" namespace is optional. For example, the std::find_if() function. This will compile with and without the "std::" namespace qualifier.

I had initially thought that I might have a "using namespace std" somewhere, but if I write "string myString;" it will fail to compile. By changing it to "std::string myString", it will work.

So can anybody explain what is going on here? Are the namespace rules different somehow for find_if vs string?

jujumbura
  • 425
  • 3
  • 9
  • Maybe one or more arguments with which you call the function are in std namespace and the function is found via ADL. – Lassie Jun 08 '17 at 18:57
  • In the future, it would be better if you had a code example showing the case you were investigating, [for example, this](http://coliru.stacked-crooked.com/a/3e0564b29625e63a). That would make the question easier to understand and not simply guesswork. – Justin Jun 08 '17 at 19:02

0 Answers0