1 – All the entities (variables, types, constants, and functions) of the standard C++ library are declared within the std
namespace. using namespace std;
introduces direct visibility of all the names of the std namespace into the code.
ref: http://www.cplusplus.com/doc/tutorial/namespaces/
2 – Namespaces in C++ are most often used to avoid naming collisions. Although namespaces are used extensively in recent C++ code, most older code does not use this facility. For example, the entire C++ standard library is defined within namespace std
, but before standardization many components were originally in the global namespace.
ref: http://en.wikipedia.org/wiki/Namespace#Use_in_common_languages
2
solved What does the namespace std add? (C++) [closed]