his_dudeness his_dudeness - 17 days ago 6x
C++ Question

C++ #include <string> vs using std::string


#include <string>


using std::string;

has same meaning? If yes why do we have a separate #include for string. If you are going to tell me that string is so popular that we got a new header, using std::string has same easyness of typing IMHO.

I would appreciate if you can clarify.

P.S. There are similar questions in SO, but they compare using namespace std to using std::string and don't answer my question.


No, they're not the same. You can add a using std::string declaration, but you still need to #include <string>.