[C++]using std string;的作用是什么

相关资料:

http://bbs.csdn.net/topics/330194465


#include <string>
将string库包含到当前编译单元中.

using std::string;

一个编译单元会有很多域...一般,这个只会出现在单独的域中.这样做是避免三件事.
1, 将std里的所有名字暴露在各个域中, 例如 把using namespace std; 写在全局中.
2, 在using std::string的域中,就可以直接使用string, 少打std::了,图方便

原文地址:https://www.cnblogs.com/FKdelphi/p/6026859.html