文章目录 1 介绍 1.1 内联函数 1.2 宏 2 区别 Reference 1 介绍 1.1 内联函数 内联函数(inline)的使用目的是为了避免函数调用的开销,而将其在每个调用点上“inline”地展开。 例如: // 内联函数, 寻找两个string中较短的那个 inline const string& shorterString(const string& s1, const string& s2) { return s1.size(