Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper types to make it easier to create a basic_json type with modified template parameters #3898

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

barcode
Copy link
Contributor

@barcode barcode commented Dec 26, 2022

(First part of the points listed in #3110 (comment), the rest is done in a different PR to prevent mixing of separate issues / features)

Make specifying a base class easier/less verbose.

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.


Pull request checklist

Read the Contribution Guidelines for detailed information.

  • Changes are described in the pull request, or an existing issue is referenced.
  • The test suite compiles and runs without error.
  • Code coverage is 100%. Test cases can be added by editing the test suite.
  • 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.

@coveralls
Copy link

coveralls commented Dec 26, 2022

Coverage Status

coverage: 100.0%. remained the same when pulling 0d9f46f on barcode:make_specifying_adapted_json_type_easier into 5d27543 on nlohmann:develop.

@barcode barcode force-pushed the make_specifying_adapted_json_type_easier branch from dc4517a to 445e5ff Compare December 26, 2022 13:17
@barcode barcode force-pushed the make_specifying_adapted_json_type_easier branch from 445e5ff to 134929c Compare January 31, 2023 18:28
@barcode
Copy link
Contributor Author

barcode commented Feb 1, 2023

Work on this PR is done and it only needs a review.

@raphael-grimm raphael-grimm force-pushed the make_specifying_adapted_json_type_easier branch from 134929c to 0d9f46f Compare August 4, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants