mirror of
https://github.com/nlohmann/json.git
synced 2024-08-23 21:42:29 +02:00
Merge pull request #439 from jaredgrubb/patch-2
README: adjust boost::optional example
This commit is contained in:
commit
affa3bf4e9
|
@ -563,7 +563,9 @@ namespace nlohmann {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void from_json(const json& j, boost::optional<T>& opt) {
|
static void from_json(const json& j, boost::optional<T>& opt) {
|
||||||
if (!j.is_null()) {
|
if (j.is_null()) {
|
||||||
|
opt = boost::none;
|
||||||
|
} else {
|
||||||
opt = j.get<T>(); // same as above, but with
|
opt = j.get<T>(); // same as above, but with
|
||||||
// adl_serializer<T>::from_json
|
// adl_serializer<T>::from_json
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue