mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 06:14:58 +01:00
Add JSON_NO_UDLS to leave out the user-defined string literals
The bodies of operator""_json and operator""_json_pointer call the parser, so every translation unit including the library instantiates it, even if it never parses anything. Defining JSON_NO_UDLS leaves the literals out entirely, which saves 15-35% compile time for such translation units (#5294). Nothing changes if the macro is not defined. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -32,6 +32,7 @@ using NLOHMANN_JSON_NAMESPACE::ordered_json;
|
||||
using NLOHMANN_JSON_NAMESPACE::ordered_map;
|
||||
using NLOHMANN_JSON_NAMESPACE::to_string;
|
||||
|
||||
#ifndef JSON_NO_UDLS
|
||||
inline namespace literals
|
||||
{
|
||||
inline namespace json_literals
|
||||
@@ -40,6 +41,7 @@ inline namespace json_literals
|
||||
using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator""_json_pointer;
|
||||
} // namespace json_literals
|
||||
} // namespace literals
|
||||
#endif
|
||||
|
||||
// Note: the following nlohmann::detail symbols must be exported due to
|
||||
// an MSVC bug failing to compile without these symbols visible (ticket #3970)
|
||||
|
||||
Reference in New Issue
Block a user