Commit affa3bf4 authored by Niels Lohmann's avatar Niels Lohmann Committed by GitHub

Merge pull request #439 from jaredgrubb/patch-2

README: adjust boost::optional example
parents f642934b f2873e6d
No related merge requests found
...@@ -563,7 +563,9 @@ namespace nlohmann { ...@@ -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
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment