Headers Should Not Include using
Declarations
Code inside headers (§ 2.6.3, p. 76) ordinarily should not use using
declarations. The reason is that the contents of a header are copied into the including program’s text. If a header has a using
declaration, then every program that includes that header gets that same using
declaration. As a result, a program that didn’t intend to use the specified library name might encounter unexpected name conflicts.
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.