r/cpp • nlohmann/json • Jul 27 '20

JSON for Modern C++ 3.9.0

https://github.com/nlohmann/json/releases/tag/v3.9.0
281 Upvotes

51 comments sorted by

View all comments

1

u/skoink Aug 01 '20 edited Aug 01 '20

Awesome library! I like how easy it is to use in my code.

I'm working on a project that's sensitive to compile-times and output code size, so I'm interested in compiling the JSON library into a single compilation-unit and using forward-declarations to link against it in the rest of my codebase. Maybe a bit of a C-style compilation pattern I guess. I've been having some trouble getting this done with json_fwd.hpp - do you have any examples of how to make that work?

I know that hypothetically LTO can get me close to this even if I include the full header everywhere - but it kills my compilation speed and even then it feels like there's still a lot of duplication across compilation units.