2

I compiled and ran a sample code of getline.

#include <iostream>
#include <string>

main ()
{
  std::string name;

  std::cout << "Please, enter your full name: ";
  std::getline (std::cin,name);
  std::cout << "Hello, " << name << "!\n";

  return 0;
}
// from `http://www.cplusplus.com/reference/string/string/getline/`

I replaced std::getline to getline, but it still works. Why is it?

AnnieFromTaiwan
  • 3,845
  • 3
  • 22
  • 38
  • 5
    See [ADL](http://stackoverflow.com/questions/8111677/what-is-argument-dependent-lookup-aka-adl-or-koenig-lookup). – chris Sep 16 '15 at 03:19
  • 1
    I see there are many duplicate questions like this one. What should I do now? Delete this question? Or wait until somebody mark this as duplicate? – AnnieFromTaiwan Sep 16 '15 at 03:27
  • 3
    @JennyaChang: no harm having some duplicates around, as they may get found by poeple using different search terms, and lead them to the answer they need. Cheers. – Tony Delroy Sep 16 '15 at 03:29

0 Answers0