I know it is possible to use the fmt formatting library in header-only mode:
How to use fmt library in the header-only mode?
but - why isn't it just header-only, period? That is, what's the benefit of using it in non-header-only mode?
I know it is possible to use the fmt formatting library in header-only mode:
How to use fmt library in the header-only mode?
but - why isn't it just header-only, period? That is, what's the benefit of using it in non-header-only mode?
On
Some functions like vformat are not templates. There is no point in putting those in headers and slowing down the whole compilation process. I would guess that's the rationale. The fmt library cares a lot about the compilation time from what I can tell.
On
what's the benefit of using it in non-header-only mode?
I'm not the author, so I cannot speak for them. But I can tell you advantages of not-header-only.
The main reason is build speed as others already correctly pointed out. For example, compiling with a static library (the default) is ~2.75x faster than with a header-only one:
In header-only libraries implementation details and dependencies leak into every translation unit that uses them.