mirror of
https://github.com/nlohmann/json.git
synced 2026-02-17 09:03:58 +00:00
Add char8_t* overload for _json and _json_pointer (#4963)
This commit is contained in:
@@ -25402,6 +25402,15 @@ JSON_HEDLEY_NON_NULL(1)
|
||||
return nlohmann::json::parse(s, s + n);
|
||||
}
|
||||
|
||||
#if defined(__cpp_char8_t)
|
||||
JSON_HEDLEY_NON_NULL(1)
|
||||
inline nlohmann::json operator""_json(const char8_t* s, std::size_t n)
|
||||
{
|
||||
return nlohmann::json::parse(reinterpret_cast<const char*>(s),
|
||||
reinterpret_cast<const char*>(s) + n);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// @brief user-defined string literal for JSON pointer
|
||||
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/
|
||||
JSON_HEDLEY_NON_NULL(1)
|
||||
@@ -25415,6 +25424,13 @@ JSON_HEDLEY_NON_NULL(1)
|
||||
return nlohmann::json::json_pointer(std::string(s, n));
|
||||
}
|
||||
|
||||
#if defined(__cpp_char8_t)
|
||||
inline nlohmann::json::json_pointer operator""_json_pointer(const char8_t* s, std::size_t n)
|
||||
{
|
||||
return nlohmann::json::json_pointer(std::string(reinterpret_cast<const char*>(s), n));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace json_literals
|
||||
} // namespace literals
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user