| It means all the code is defined in-line in the header file, inside the class definition, instead of the more traditional method of using a header and an associated cpp file. A lot of the C++ standard library (STL) and Boost are header only (but not all) This means to use the code, all you need to do is #include the header file wherever you need it, rather than including a header file and either building a separate static/shared library for the cpp file, or including it in your own build. So that's really convenient. Another thing that happens is that the by doing this, the compiler can potentially do a lot better job of optimizing the code by inlining parts of the library straight into your calling function. With static libraries it is possible to get some optimizations like this made at link time, since link time code generation is a requirement for templates, but that's not possible with shared libraries since you are forced to call through an exported function entry point by their very nature. Header only libraries are typical for containers or light weight libraries where the cost of inclusion and possible code duplication of code is worth the performance gains, and certainly very popular where templates are involved. tl;dr, header only is cool just because they are so easy to consume and don't need a make file. Just #include and you are done. |