Isn't C++'s inline totally optional?

后端 未结 4 1055
后悔当初
后悔当初 2020-12-08 01:24

I have a class that had an inline member, but I later decided that I wanted to remove the implementation from the headers so I moved the members body of the functions out to

4条回答
  •  感动是毒
    2020-12-08 02:12

    Whether or not the method is actually inlined is at the sole discretion of the compiler. However the presence of the inline keyword will also affect the linkage of the method.

    C++ linkage is not my specialty so I'll defer to the links for a better explanation.

    • http://publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.cbclx01/inline_linkage.htm
    • http://en.wikipedia.org/wiki/Inline_function

    Alternately you can just wait for litb to provide the gory details in an hour or so ;)

提交回复
热议问题