This PR adds member templates to nlohmann::json which can be used to create a basic_json type with one replaced template parameter (e.g. nlohmann::json::with_changed_json_serializer_t<T>).
Tests and examples were modified to use those templates (except for regression tests).
Open questions from my side:
Should we add something like this? (I think so, but what is your opinion?)
Should we go with the current names (with_changed_*) or rather use something else (e.g. with_*)?
In case this will be added, i will write the documentation.
[x] The source code is amalgamated; that is, after making changes to the sources in the include/nlohmann directory, run make amalgamate to create the single-header files single_include/nlohmann/json.hpp and single_include/nlohmann/json_fwd.hpp. The whole process is described here.
coverage: 100.0%. remained the same when pulling 0d9f46f66dd952a5d3d7f7bff97ac03003fddc37 on barcode:make_specifying_adapted_json_type_easier into 5d2754306d67d1e654a1a34e1d2e74439a9d53b3 on nlohmann:develop.
(First part of the points listed in https://github.com/nlohmann/json/pull/3110#issuecomment-1229141478, the rest is done in a different PR to prevent mixing of separate issues / features)
This PR adds member templates to
nlohmann::json
which can be used to create abasic_json
type with one replaced template parameter (e.g.nlohmann::json::with_changed_json_serializer_t<T>
).Tests and examples were modified to use those templates (except for regression tests).
Open questions from my side:
with_changed_*
) or rather use something else (e.g.with_*
)?In case this will be added, i will write the documentation.
Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filessingle_include/nlohmann/json.hpp
andsingle_include/nlohmann/json_fwd.hpp
. The whole process is described here.