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

_json operator""() #3644

Closed
2 tasks
boris-999 opened this issue Aug 1, 2022 · 4 comments · Fixed by #3646
Closed
2 tasks

_json operator""() #3644

boris-999 opened this issue Aug 1, 2022 · 4 comments · Fixed by #3646
Assignees
Labels
documentation kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@boris-999
Copy link

Description

had some issues with operator"" _json namespacing. added the #define as per docs: https://json.nlohmann.me/api/operator_literal_json/ then there was an issue with #if JSON_USE_GLOBAL_UDLS not making any sense. should that be #ifdef ?

Reproduction steps

  1. #define JSON_USE_GLOBAL_UDLS
  2. #if JSON_USE_GLOBAL_UDLS causes compiler error

Expected vs. actual results

probaly should be #ifdef, not #if

Minimal code example

No response

Error messages

No response

Compiler and operating system

msvc 2019 - 16.11.17 (current as of 2022-08-02)

Library version

3.11.0

Validation

@falbrechtskirchinger
Copy link
Contributor

This line in the documentation should probably read:

Alternatively, define JSON_USE_GLOBAL_UDLS to 1 to make them available in the global namespace.

That is, please use #define JSON_USE_GLOBAL_UDLS 1. That is the default, though. Can you elaborate on what your problem is and how I might reproduce it?

@gregmarr
Copy link
Contributor

gregmarr commented Aug 1, 2022

The default is to have that defined to 1. Define it to 0 if you want to disable the default behavior:

https://json.nlohmann.me/api/macros/json_use_global_udls/

@falbrechtskirchinger Maybe this line is left over from before it was the default:

https://json.nlohmann.me/api/operator_literal_json/
Alternatively, define JSON_USE_GLOBAL_UDLS to make them available in the global namespace.

@falbrechtskirchinger
Copy link
Contributor

falbrechtskirchinger commented Aug 1, 2022

We clearly had the same thought. :-)

I'll make a note of the documentation issue.

@gregmarr
Copy link
Contributor

gregmarr commented Aug 1, 2022

@falbrechtskirchinger Got here just before me. :)

@nlohmann nlohmann added this to the Release 3.11.1 milestone Aug 1, 2022
@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants