Can we get a function to be inline in C ++

In general, the inline keyword is just a request to the compiler, and based on the implementation of the function, the compiler will resolve this inline extension. But is there any way to force the function to be inline and how can we do it.

+3


source to share


1 answer


This is entirely compiler dependent, some compilers provide the means to do what you want.



  • For gcc look at this , there is an attribute always_inline

    ;
  • For msvc check here it has a specifier __forceinline

    .
+3


source







All Articles