When should I write the keyword 'inline' for a function/method?

后端 未结 15 2508
清歌不尽
清歌不尽 2020-11-21 06:55

When should I write the keyword inline for a function/method in C++?

After seeing some answers, some related questions:

  • When should I <

15条回答
  •  猫巷女王i
    2020-11-21 07:12

    1) Nowadays, pretty much never. If it's a good idea to inline a function, the compiler will do it without your help.

    2) Always. See #1.

    (Edited to reflect that you broke your question into two questions...)

提交回复
热议问题