Why do I need to write "std::string" but not "std::getline()"?

Viewed 2106

Consider this bit of code:

#include <iostream>                                                   
#include <string>

int main()
{
  std::string str;
  std::cout << "Enter a string: \n";
  getline(std::cin, str);
}

Why must I use std:: for string, cin and cout, but not getline()? Is getline() not in the standard library? I'm actually somewhat confused why I can't just write using namespace std; and not have to #include anything in the standard library, too. Thanks in advance!

1 Answers
Related