Inner join can improve the execution efficiency of functions. Why not define all functions as inline functions?
If all functions are inline functions, do you still need the keyword "inline?
Inline is at the cost of code expansion (replication). It only saves the overhead of function calls and improves the function execution efficiency. If the execution time of code in the function body is higher than the overhead of function calling, the efficiency gains will be little. On the other hand, every call to an inline function must copy the code, which will increase the total amount of code in the program and consume more memory space. Inline is not recommended in the following cases:
(1) If the code in the function body is long, using inline will cause high memory consumption.
(2) If there is a loop in the function body, the execution time of the Code in the function body is longer than the overhead of the function call.
Class constructor and destructor are easy to misunderstand that using inline is more effective. Be careful that constructors and destructor may hide some behaviors, such as secretly executing constructors and destructor of base classes or member objects. Therefore, do not place the constructor and destructor definitions in the class declaration.
A good compiler will automatically cancel the inline that is not worthwhile based on the definition body of the function (this further demonstrates that inline should not appear in the declaration of the function ).