inlineThis is just a suggestion to the compiler, not a requirement.
However, the implementation of mainstream compilers will ignore your suggestions. If you turn on O2, short functions will be automatically inlined, but long functions will not be inlined. So ignore it.
In this case, the compiler will directly inline the outer function.
inline
This is just a suggestion to the compiler, not a requirement.However, the implementation of mainstream compilers will ignore your suggestions. If you turn on
O2
, short functions will be automatically inlined, but long functions will not be inlined. So ignore it.Add it, inlining will remove your extra layer of encapsulation, and the encapsulation inside should still be there
Don’t worry about these issues, it doesn’t matter whether the code optimized by the compiler is
inline
or not.First figure out what inline is for,