Do you prefer explicit namespaces or 'using' in C++?

前端 未结 8 905
旧巷少年郎
旧巷少年郎 2020-12-06 01:16

When using C++ namespaces, do you prefer to explicitly name them, like this:

std::cout << \"Hello, world!\\n\";

Or do you prefer

8条回答
  •  暖寄归人
    2020-12-06 01:37

    I use always explicit ones. Writing std does not hurt me and I clearly see where is it from. It's useful when you have some legacy project to take care of with it's own "strings", "vectors" etc to maintain. The more information the code carries with it, the better.

提交回复
热议问题