Can modern C++ compilers inline functions that are defined in a cpp file

后端 未结 4 1113
无人及你
无人及你 2020-12-09 03:10

I am aware that the keyword inline has useful properties e.g. for keeping template specializations inside a header file. On the other hand I have often read tha

4条回答
  •  爱一瞬间的悲伤
    2020-12-09 03:41

    The standard dictates nothing about how a function can be inlined. And compilers can inline functions if they have access to their implementation. If you only have a header with binaries, it would be impossible. If it's in the same module, the compiler can inline the function even if it is in the cpp file.

提交回复
热议问题