3 ms·
header-only usually means there's one or more .h/.hpp files that you can include in your source. There's no source file or library to compile and include e.g.
by mohaps 10y ago
header-only usually means there's one or more .h/.hpp files that you can include in your source. There's no source file or library to compile and include
e.g. if I had Hello.h and Hello.cpp, you'd need to either add Hello.cpp to your make/build or build a library and link to it.
Header-only version means all you do is
#include "Hello.h"
and you're all set to go.
- tobz 10y agoSo in this case, headers-only is really just an approach to avoid compiling a separate library? More akin to literally including the source code in your source code, in the eyes on the compiler. All in the same object/library.
- mohaps 10y agomostly: yes! :) Also, keep in mind that most of the library is templates, which need to go in the header files. BTW, most of boost is header-only :) e.g. boost/noncopyable.hpp would give you a header only equivalent of the NoCopy class I wrote. I've always felt weird about having to include some big-arse library for just using a simple container, so for things like this I prefer to write header-only versions.
- tobz 10y agoCool. Thanks for the edification.