天天看點

避免随意使用 “using namespace std;”

Since the C++ standard has been accepted, practically all of the standard library is inside the std namespace. So if you don’t want to qualify all standard library calls with std::, you need to add the using directive.

However,

is considered a bad practice because you are practically importing the whole standard namespace, thus opening up a lot of possibilities for name clashes. It is better to import only the stuff you are actually using in your code, like

StackOverflow

c++

繼續閱讀