-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Request: access with default value. #353
Comments
This sounds related to the |
@SmoofBullet Did you have the time to look at the value function? |
@nlohmann method "value" helps to avoid outing of range only. If requested field exists, but has different type then this method throws exception. Such behavior is undesirable. |
There has been quite a discussion about this, see #278. |
So this functional will be implemented in release 3.0.0? Great (apropos when it happens?)! |
Yes, i can. :) But could starter of this ticket? |
Oh, sorry. @SmoofBullet What do you think? |
I think the solution will work for me, although im not sure whether the value function should be restricted to object types. If i provide a default value, i would not mind if the caller passed me the wrong type (something different than object). |
Hi everyone!
I would suggest to provide new member functions
I use those for convenient accesses to numbers, strings, vectors and maps in a json object with default values.
Further, i use
for more consistent code look when using the functions above.
What do you think?
Greetings
The text was updated successfully, but these errors were encountered: