Why getline () from the header is a 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; }
This works with gcc. But why? It is defined in the string header, so I would need to use std :: getline () instead of getline ().
Peter source share