I'm using the 'using' declaration in C++ to add std::string and std::vector to the local namespace (to save typing unnecessary 'std::'s).
using std::string;
using std::vector;
class Foo { /*...*/ };
What is the scope on this declaration? If I do this in a header, will it inject these 'using' declarations into every cpp file that includes the header?
usingdeclaration (orusingdirective) at file scope in an include file/header! That will cause headaches for users of the header.usingdeclaration (a fortiori directive) in a header at all, even within a namespace! See scope of using declaration within a namespace for problems this causes.usingin class and function scope is safe regarding the discussed problem.