Is there a possibility to have a using
directive whose scope is limited to a single class?
Note, that what I want to "use" is not contained in the parent of the current class.
For simplicity, assume the following exmple:
#include<vector>
class foo
{
using std::vector; //Error, a class-qualified name is required
}
Another interesting thing to know is, if the using
directives are included, if a header is included:
MyClassFoo.h:
#include<vector>
using std::vector; //OK
class foo
{
}
And in
NewHeader.h
#include "MyClassFoo.h"
...
how can I prevent "using std::vector
" to be visible here?
using
declarations can be templated when creating type aliases, and it's okay to call that type aliasvector
since it's in another scope fromstd::vector
. – Admixture