My question is pretty much the title. Example
#include <iostream>
int main()
{
using std::cout; //legal?
{
using std::cin; //legal?
}
}
My question is pretty much the title. Example
#include <iostream>
int main()
{
using std::cout; //legal?
{
using std::cin; //legal?
}
}
Yes, it's legal. In fact, it's preferred over doing it at file scope...
using namespace?A using-declaration introduces a name into the declarative region in which the using-declaration appears.
And, since someone asked in a comment about using namespace:
A using-directive shall not appear in class scope, but may appear in namespace scope or in block scope.