Fix deprecation warning (#4161)

This commit is contained in:
Niels Lohmann 2023-09-23 20:16:37 +02:00 committed by GitHub
parent 6e36c721f0
commit bbd2e1636d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 12 deletions

View File

@ -1,7 +1,7 @@
# <small>nlohmann::</small>operator""_json # <small>nlohmann::</small>operator""_json
```cpp ```cpp
json operator "" _json(const char* s, std::size_t n); 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 This operator implements a user-defined string literal for JSON objects. It can be used by adding `#!cpp _json` to a
@ -9,7 +9,7 @@ string literal and returns a [`json`](json.md) object if no parse error occurred
It is recommended to bring the operator into scope using any of the following lines: It is recommended to bring the operator into scope using any of the following lines:
```cpp ```cpp
using nlohmann::literals::operator "" _json; using nlohmann::literals::operator ""_json;
using namespace nlohmann::literals; using namespace nlohmann::literals;
using namespace nlohmann::json_literals; using namespace nlohmann::json_literals;
using namespace nlohmann::literals::json_literals; using namespace nlohmann::literals::json_literals;

View File

@ -1,7 +1,7 @@
# <small>nlohmann::</small>operator""_json_pointer # <small>nlohmann::</small>operator""_json_pointer
```cpp ```cpp
json_pointer operator "" _json_pointer(const char* s, std::size_t n); 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` This operator implements a user-defined string literal for JSON Pointers. It can be used by adding `#!cpp _json_pointer`
@ -9,7 +9,7 @@ to a string literal and returns a [`json_pointer`](json_pointer/index.md) object
It is recommended to bring the operator into scope using any of the following lines: It is recommended to bring the operator into scope using any of the following lines:
```cpp ```cpp
using nlohmann::literals::operator "" _json_pointer; using nlohmann::literals::operator ""_json_pointer;
using namespace nlohmann::literals; using namespace nlohmann::literals;
using namespace nlohmann::json_literals; using namespace nlohmann::json_literals;
using namespace nlohmann::literals::json_literals; using namespace nlohmann::literals::json_literals;

View File

@ -5162,7 +5162,11 @@ inline namespace json_literals
/// @brief user-defined string literal for JSON values /// @brief user-defined string literal for JSON values
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/ /// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/
JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json operator "" _json(const char* s, std::size_t n) #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
inline nlohmann::json operator ""_json(const char* s, std::size_t n)
#else
inline nlohmann::json operator "" _json(const char* s, std::size_t n)
#endif
{ {
return nlohmann::json::parse(s, s + n); return nlohmann::json::parse(s, s + n);
} }
@ -5170,7 +5174,11 @@ inline nlohmann::json operator "" _json(const char* s, std::size_t n)
/// @brief user-defined string literal for JSON pointer /// @brief user-defined string literal for JSON pointer
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/ /// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/
JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n) #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
inline nlohmann::json::json_pointer operator ""_json_pointer(const char* s, std::size_t n)
#else
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)
#endif
{ {
return nlohmann::json::json_pointer(std::string(s, n)); return nlohmann::json::json_pointer(std::string(s, n));
} }
@ -5234,8 +5242,13 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
} // namespace std } // namespace std
#if JSON_USE_GLOBAL_UDLS #if JSON_USE_GLOBAL_UDLS
using nlohmann::literals::json_literals::operator "" _json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers) #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
using nlohmann::literals::json_literals::operator "" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers) using nlohmann::literals::json_literals::operator ""_json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator ""_json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
#else
using nlohmann::literals::json_literals::operator "" _json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator "" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
#endif
#endif #endif
#include <nlohmann/detail/macro_unscope.hpp> #include <nlohmann/detail/macro_unscope.hpp>

View File

@ -24368,7 +24368,11 @@ inline namespace json_literals
/// @brief user-defined string literal for JSON values /// @brief user-defined string literal for JSON values
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/ /// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/
JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json operator "" _json(const char* s, std::size_t n) #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
inline nlohmann::json operator ""_json(const char* s, std::size_t n)
#else
inline nlohmann::json operator "" _json(const char* s, std::size_t n)
#endif
{ {
return nlohmann::json::parse(s, s + n); return nlohmann::json::parse(s, s + n);
} }
@ -24376,7 +24380,11 @@ inline nlohmann::json operator "" _json(const char* s, std::size_t n)
/// @brief user-defined string literal for JSON pointer /// @brief user-defined string literal for JSON pointer
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/ /// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/
JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n) #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
inline nlohmann::json::json_pointer operator ""_json_pointer(const char* s, std::size_t n)
#else
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)
#endif
{ {
return nlohmann::json::json_pointer(std::string(s, n)); return nlohmann::json::json_pointer(std::string(s, n));
} }
@ -24440,8 +24448,13 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
} // namespace std } // namespace std
#if JSON_USE_GLOBAL_UDLS #if JSON_USE_GLOBAL_UDLS
using nlohmann::literals::json_literals::operator "" _json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers) #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
using nlohmann::literals::json_literals::operator "" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers) using nlohmann::literals::json_literals::operator ""_json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator ""_json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
#else
using nlohmann::literals::json_literals::operator "" _json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator "" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
#endif
#endif #endif
// #include <nlohmann/detail/macro_unscope.hpp> // #include <nlohmann/detail/macro_unscope.hpp>