-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
Question
According to the document for "JSON for Modern C++", when the variable type is "std::nullptr_t", it returns "null".
It's a silly question, but if assigning "nullptr" to "std::string" like "Example", which one is intended as the specification?
(1) it causes the segmentation fault by undefined behavior of std::string
(2) it returns "null" as same as "std::nullptr_t"
It seems that (1) is the specification: it's undesired to assign "nullptr" to "std::string".
Is it correct about my understanding?
[Example]
#include <iostream>
#include <nlohmann/json.hpp>
int main() {
nlohmann::json j;
std::string value = nullptr;
j[ "value" ] = value;
std::cout << j << std::endl;
...
}
Version
- JSON for Modern C++ 3.7.3
- Linux gcc 8.3.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation