Reputation: 9451
I am a python programmer, and just learning some C++ on the side.
From what I understand, in C++ using namespace std
would be equivalent to python's from std import *
, and should not be used.
1) Correct?
And then in Python, I could do for example from std import cout, cin
.
2) Is there a single line equivalence? Or would I have to do it in multiple lines?
using std::cout;
using std::cin;
Upvotes: 2
Views: 1047
Reputation: 11
Yes , there is one way you can import multiple members but its not supported everywhere.
using std::cout,std::endl;
But you will get a warning.
warning: comma-separated list in using-declaration only available with -std=c++1z or -std=gnu++1z using std::cout,std::endl; ^
Upvotes: 1