C++ header-only template library

后端 未结 9 2103
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 20:21

Looking at this project (http://www.savarese.com/software/libssrckdtree/) I found the definition \"C++ header-only template library\". At the moment I have basic C++ knowled

9条回答
  •  轮回少年
    2020-12-09 20:54

    It means that there are no modules in the library, only headers. That means the library can be used without requiring it to be first compiled and later linked in; just include the headers in your own source modules.

    The benefits of this approach are

    1. It's easier to include, since you don't need to specify linker options in your build system.
    2. You always compile all the library code with the same compiler (options) as the rest of your code, since the library's functions get inlined in your code.
    3. It may be a lot faster.

    In this case, the container datastructure implemented templated on the type of data it contains, so it cannot be fully compiled.

提交回复
热议问题