json
json copied to clipboard
Split inline namespace and allow version namespace to be disabled
Split the versioned, ABI-tagged inline namespace into separate tag and version namespaces.
Example: nlohmann::nlohmann_json_diag::v3_11_1
The prefix of the tag namespace cannot be json
as that would conflict with the type alias nlohmann::json
.
~~The version namespace can be disabled by defining NLOHMANN_JSON_NAMESPACE_VERSION_NAMESPACE
without a value. The long macro name is unfortunate, but NLOHMANN_JSON_VERSION_NAMESPACE
doesn't sort well and NLOHMANN_JSON_NAMESPACE_VERSION
sounds confusing.~~
Coverage remained the same at 100.0% when pulling 5385b0562b15c2fce127e07f3aee83e9f1bff189 on falbrechtskirchinger:inline-ns-update into a92ccafd2c7709243451e947a21ad08203273483 on nlohmann:develop.
What is the benefit of having the version part a separate namespace that may or may not be used instead of just a part of the name that may or may not be there?
It just expresses the hierarchy between the truly (and always) ABI-breaking settings and library versions. I don't really know yet if that's useful, but I don't think it hurts either.
ci_test_single_header failing is expected until #3679 is merged.
Is there a way to get back to the original behavior and just have a nlohmann
namespace with basic_json
right in it without inline namespaces?
Yes. Since 3.11.0. https://github.com/nlohmann/json/issues/3657#issuecomment-1207175931 (And the test has been added to this PR.)
I've added a first, rough version of features/namespace.md
. Clearly needs more polish in the future. Looking forward to incorporating any suggestions you may have.
Here's how the plantuml
diagram in features/namespace.md
renders: