Significance of a .inl file in C++

后端 未结 5 1177
旧时难觅i
旧时难觅i 2020-12-02 05:22

What are the advantages of having declarations in a .inl file? When would I need to use the same?

5条回答
  •  既然无缘
    2020-12-02 05:48

    Since nobody else has mentioned it:

    The use of .inl files to store your inline functions can be useful for speeding up compiles.

    If you only include the declarations (.h) where you need declarations, and only include inline implementations (.inl) where you need them ( i.e. probably only in .cpp and other .inl files, not .h's ), it can have a beneficial effect on your header dependencies.

    This can be a significant win on larger projects with many interacting classes.

提交回复
热议问题