You've got to know where to find them, know how to bind them, know when to ask for help, from a hidden friend...
Argument-Dependent Lookup and the Hidden Friend Idiom
by Rainer Grimm
From the article:
Have you ever wondered why the following program works?
#include <iostream> int main() { std::cout << "Hello world"; }Why should the program not work? The overloaded output operator
operator<<
is defined in thestd
namespace. The question is, therefore: How is the appropriate overloaded output operator forstd::string
found? You may already assume it...
Add a Comment
Comments are closed.