Bad practice to declare names in the standard namespace?

前端 未结 5 707
轻奢々
轻奢々 2021-01-18 02:15

I was looking through the Google C++ style guide, and came across this:

\"Do not declare anything in namespace std, not even forward declarations of standard library

5条回答
  •  被撕碎了的回忆
    2021-01-18 03:04

    This isn't saying "Do not use the standard library".

    To use something, and to declare something, are two different things. It's saying don't declare anything as in don't do something like "class ostream;". I guess people used to have to declare it like that in order to use it, but now, since things are declared in namespace std, you simply include the header file.

    Check this out.

提交回复
热议问题