-1
When you make the directive:
using namespace std; //primeira forma
You get direct access to all elements of the Std namespace.
But imagine that you want to use only the std::cout
or std::endl
so it would be better to use the directive:
using std::cout; //segunda forma
using std::endl;
So you would only get the objects that need to use not all.
My question is: is there a way to visualize everything that is added when using the command using namespace std;
?
Something like (I know this is highly wrong):
#include <iostream>
using namespace std;
int main(){
cout << std;
return 0;
}
My question is in the following sense: I read that it is preferable to use the second form of directive using mentioned than to use the general form. The book explained that usually the first form adds things that you don’t use. So I wanted to know if there is a way to visualize these 'things'. Anyway I already found the answer here https://stackoverflow.com/questions/45123958/is-it-possible-to-view-all-the-contents-of-a-namespace-in-c.
That doesn’t answer the question. https://stackoverflow.com/questions/45123958/is-it-possible-to-view-all-the-contents-of-a-namespace-in-c/45123996#45123996 this does not answer.
– BrunoVdutra
I don’t get it, it basically says the same thing.
– Maniero