When should I use -inl.h files?

后端 未结 3 791
有刺的猬
有刺的猬 2021-02-14 18:19

I just noted this item in the Google C++ Coding Style Guide - and I don\'t quite get it.

If I put an inline method or function in a file other than the header included b

3条回答
  •  粉色の甜心
    2021-02-14 18:40

    According to latest Google coding style, it is no longer allowed https://google.github.io/styleguide/cppguide.html#Variable_Names

    Prefer placing the definitions for template and inline functions in the same file as their declarations. The definitions of these constructs must be included into every .cc file that uses them, or the program may fail to link in some build configurations. If declarations and definitions are in different files, including the former should transitively include the latter. Do not move these definitions to separately included header files (-inl.h); this practice was common in the past, but is no longer allowed.

提交回复
热议问题