Possible Duplicate:
How can I “unuse” a namespace?
After declaring “using namespace mynamespace”, for example, is it possible to stop using that namespace mid-code?
Thanks for your help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take a look at the C++ documentation on Namespaces.
http://www.cplusplus.com/doc/tutorial/namespaces/
You can declare that you are ‘using’ a namespace for a specific scope (such as a function). But I don’t believe you can arbitrarily specify where a using statement starts and ends, it is always for the rest of the scope it is declared in.
I should note (someone please correct me if I’m wrong) that in C++ you can arbitrarily declare a scope almost anywhere you want, simply by using curly braces.
But use it sparingly and carefully, because if used too often or in the wrong context, it can make code harder to read (which defeats the whole point of ‘using’ in the first place, right?).