请输入您要查询的百科知识:

 

词条 Header-only
释义

  1. List of (mostly) header-only libraries

  2. References

  3. External links

{{More citations needed|date=January 2019}}

In the context of the C or C++ programming languages, a library is called header-only if the full definitions of all macros, functions and classes comprising the library are visible to the compiler in a header file form.[1] Header-only libraries do not need to be separately compiled, packaged and installed in order to be used. All that is required is to point the compiler at the location of the headers (the -I switch in gcc/g++), and then #include the header files into the application source. Another advantage is that the compiler's optimizer can do a much better job when all the library's source code is available.

The disadvantages include:

  • brittleness – most changes to the library will require recompilation of all compilation units using that library
  • longer compilation times – the compilation unit must see the implementation of all components in the included files, rather than just their interfaces
  • code-bloat (this may be disputed) – the necessary use of inline statements in non-class functions can lead to code bloat by over-inlining.

Nonetheless, the header-only form is popular because it avoids the (often much more serious) problem of packaging.

For templates, including the definitions in header is the only way to compile, since the compiler needs to know the full definition of the templates in order to instantiate.

List of (mostly) header-only libraries

{{Expand list|date=February 2011}}
  • [https://github.com/Ableton/link Ableton Link]
  • [https://arduinojson.org/ ArduinoJson]
  • [https://bitbucket.org/blaze-lib/blaze Blaze]
  • Some of the Boost C++ Libraries
  • [https://github.com/catchorg/Catch2 Catch2]
  • [https://uscilab.github.io/cereal/ cereal]
  • EIGEN
  • [https://github.com/nlohmann/json JSON for Modern C++]
  • [https://mavlink.io/en/ MAVLink]
  • [https://code.google.com/p/mili/ MiLi]
  • OpenGL Mathematics
  • PCG-Random
  • [https://github.com/pybind/pybind11 pybind11]
  • [https://github.com/miloyip/rapidjson RapidJSON]
  • RapidXML
  • SGLIB
  • [https://github.com/gabime/spdlog/ spdlog]
  • STLSoft C++ Libraries
  • [https://github.com/thrust/thrust Thrust]
  • [https://troydhanson.github.io/uthash/ uthash]
  • VOLE
  • [https://github.com/zaphoyd/websocketpp WebSocket++]
  • [https://github.com/QuantStack/xtensor xtensor]

References

1. ^{{cite book | last = Wilson | first = Matthew | authorlink = Matthew Wilson (author) | year = 2004 | title = Imperfect C++ | publisher = Addison-Wesley | isbn = 0-321-22877-4 | page = 177}}

External links

3 : C++|C headers|C libraries

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/21 14:30:31