ADL (simple case)
I'm reading The C++ Programming Language, 4th Edition (by Bjarne). Here is
the quote (26.3.6, Overaggressive ADL):
Argument-dependent lookup (often referred to as ADL) is very useful to
avoid verbosity (14.2.4). For example:
#include <iostream>
int main()
{
std::cout << "Hello, world" << endl; // OK because of ADL
}
And here's the result produced by the compiler (C++11 mode):
prog.cpp: In function 'int main()':
prog.cpp:4:36: error: 'endl' was not declared in this scope
std::cout << "Hello, world" << endl;
^
Either this is a bug in the compiler or in the book. What does the
standard say?
No comments:
Post a Comment