C++ getline() doesn't require namespace declaration
c++, scope
Solution
You're experiencing Argument Dependent Lookup (ADL, and also referred to as Koenig Lookup). Since one or more of the arguments is a type defined in the `std` namespace, it searches for the function in the `std` namespace in addition to wherever else it would search. I point you to Stephan T. Lavavej's video to learn more about it and name lookup in general.
Problem
Why is getline() from header string in local scope and can be used: ``` #include <iostream> #include <string> int main() { std::string str; getline(std::cin, str); std::cout << str << "\n"; return 0; } ``` That works with gcc. But why? It is defined in header string, which should required me to use std::getline() instead of getline().