3 ms·
Proper "stb-style" header-only libs split the header into 2 parts: the declaration part that's always included and parsed but only contains the public API decla
by flohofwoe 8y ago
Proper "stb-style" header-only libs split the header into 2 parts: the declaration part that's always included and parsed but only contains the public API declarations, and the implementation part inside an #ifdef XXX_IMPLEMENTATION section which is only included and parsed in a single source file.
The same idea can also be used for C++ headers (unless it's all template interfaces).
With such stb-style headers, you can even get better compile times, because you can include all header-libs into a single implementation source file, giving the same advantages as unity-builds (merging all sources into one file).
PS: origin of the name "stb-style": https://github.com/nothings/stb https://github.com/nothings/stb (although I guess the general idea existed before)