inline、constexpr 函数与编译期计算基础 | C++
本章覆盖:`inline` 的语言语义不是“保证内联优化”;multiple definition allowance;header 中函数定义;`constexpr`;constant evaluation;constexpr function;compile-time vs runtime;`consteval` 的 C++20 定位;`constinit` 的定位;编译期计算应服务于正确性和成本,而不是炫技。
本章知识点
inline的语言语义不是“保证内联优化”- multiple definition allowance
- header 中函数定义
constexpr- constant evaluation
- constexpr function
- compile-time vs runtime
consteval的 C++20 定位constinit的定位- 编译期计算应服务于正确性和成本,而不是炫技