在XX公司工作第二天,维护已有代码

根据《C++ More Exception》所述的规则:

Rule #1: Never write using-directives in header files.

Rule #2: Never write namespace using-declarations in header files.

Rule #3: In implementation files, never use a using-declaration or a using-directive before #include directive.

Rule #4: Use C headers with the new style #include <cheader> instead of the old style #include <header.h>.


1.今天我把我负责的代码全部头文件里的using命令和声明全部移动到实现文件里,并在实现文件里将using放置在全部头文件的后面。

2.去除了关于std空间的前向声明

3.给变量起了一个更好的名字


备注一下:前向声明其它命名空间形式例如以下

namespace android{
class TouchInputMapper; (类)
template <typename T> class Singleton;(模版)
}

原文地址:https://www.cnblogs.com/gavanwanggw/p/7202569.html