1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-29 23:01:16 +03:00

Fix global UDLs (#3646)

* Add ci_test_noglobaludls to CI

* Really default JSON_GLOBAL_UDLS to 1

* Test global UDLs

* Suppress warnings

* Clarify documentation
This commit is contained in:
Florian Albrechtskirchinger
2022-08-01 22:42:35 +02:00
committed by GitHub
parent 817a4a2117
commit cbaf1033be
19 changed files with 58 additions and 25 deletions

View File

@ -7,16 +7,17 @@ json operator "" _json(const char* s, std::size_t n);
This operator implements a user-defined string literal for JSON objects. It can be used by adding `#!cpp _json` to a
string literal and returns a [`json`](json.md) object if no parse error occurred.
Use any of the following lines to bring the operator into scope:
It is recommended to bring the operator into scope using any of the following lines:
```cpp
using nlohmann::literals::operator "" _json;
using namespace nlohmann::literals;
using namespace nlohmann::json_literals;
using namespace nlohmann::literals::json_literals;
using namespace nlohmann;
```
This is suggested to ease migration to the next major version release of the library.
See ['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details.
Alternatively, define [`JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md) to make them available in the global
namespace.
## Parameters
`s` (in)

View File

@ -7,16 +7,17 @@ json_pointer operator "" _json_pointer(const char* s, std::size_t n);
This operator implements a user-defined string literal for JSON Pointers. It can be used by adding `#!cpp _json_pointer`
to a string literal and returns a [`json_pointer`](json_pointer/index.md) object if no parse error occurred.
Use any of the following lines to bring the operator into scope:
It is recommended to bring the operator into scope using any of the following lines:
```cpp
using nlohmann::literals::operator "" _json_pointer;
using namespace nlohmann::literals;
using namespace nlohmann::json_literals;
using namespace nlohmann::literals::json_literals;
using namespace nlohmann;
```
This is suggested to ease migration to the next major version release of the library.
See ['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details.
Alternatively, define [`JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md) to make them available in the global
namespace.
## Parameters
`s` (in)