-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 apply*() functions (visitor pattern) #3450
Draft
falbrechtskirchinger
wants to merge
11
commits into
nlohmann:develop
Choose a base branch
from
falbrechtskirchinger:apply
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add apply*() functions (visitor pattern) #3450
falbrechtskirchinger
wants to merge
11
commits into
nlohmann:develop
from
falbrechtskirchinger:apply
+3,710
−604
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
falbrechtskirchinger
force-pushed
the
apply
branch
from
April 21, 2022 19:48
94bae9b
to
fd9c467
Compare
9 tasks
falbrechtskirchinger
force-pushed
the
apply
branch
2 times, most recently
from
April 22, 2022 23:26
50d9360
to
780a294
Compare
Fixes nlohmann#3130. Related discussion: nlohmann#3408
Document how CMake chooses which C++ standard version to use when building tests.
falbrechtskirchinger
force-pushed
the
apply
branch
3 times, most recently
from
May 3, 2022 19:23
13e4102
to
973d979
Compare
Add 3 variants of apply*() functions that invoke a given callable with the supplied arguments and the stored JSON value. * void apply(Fn, Args...): ... * void apply_cb(ResultCallback, Fn, Args...): ... * R apply_r(Fn, Args...): ...
falbrechtskirchinger
force-pushed
the
apply
branch
from
May 3, 2022 23:01
973d979
to
ad0373f
Compare
Clang <4 fails to compile std::forward_as_tuple() calls involving basic_json values. As a workaround, the values are wrapped using std::reference_wrapper.
falbrechtskirchinger
force-pushed
the
apply
branch
3 times, most recently
from
May 4, 2022 06:05
595e4ae
to
2df1efd
Compare
Lambdas with certain noexcept specifiers are deemed non-invocable at compile-time, failing at runtime.
The invoke implemenation does not compile on GCC 8.1.0.
apply_invoke overload resolution fails for unknown reason.
falbrechtskirchinger
force-pushed
the
apply
branch
from
May 5, 2022 17:55
2df1efd
to
04b4d79
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has been factored out of #3446 but builds upon that PR and needs to be rebased.
Originally, I was looking for a workaround to be able to use
std::ranges::sort()
withbasic_json
.std::ranges::sort(j)
fails to compile becausebasic_json
doesn't (and can't) satisfy thestd:random_access_iterator
concept. This PR is the product of this search and adds 3 variants of visitor-styleapply*(Fn, Args...)
functions tobasic_json
which invoke a given callable (Fn
) with the stored JSON value and any additional arguments (Args...
).(Describe functions, etc.)
To Do: