using Directives Should Not Be Placed in Headers

namespaces are particularly useful in large-scale applications that use many class libraries. In such cases, there’s a higher likelihood of naming conflicts. When working on such projects, there should never be a using directive in a header. Having one brings the corresponding names into any file that includes the header. This could result in name collisions and subtle, hard-to-find errors. Instead, use only fully qualified names in headers (for example, std::cout or std::string).

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.