Mercurial > code
comparison cpp/json_util/json_util.cpp @ 656:734ce3a26a58
json_util: upgrade to 3.5.0 and add string_view overload
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 21 Jan 2019 20:45:02 +0100 |
parents | 87e1f4c7da76 |
children |
comparison
equal
deleted
inserted
replaced
655:a0239cca29fa | 656:734ce3a26a58 |
---|---|
83 return std::nullopt; | 83 return std::nullopt; |
84 | 84 |
85 return value.get<std::string>(); | 85 return value.get<std::string>(); |
86 } | 86 } |
87 | 87 |
88 auto type_traits<std::string_view>::get(const json& value) -> std::optional<std::string_view> | |
89 { | |
90 if (!value.is_string()) | |
91 return std::nullopt; | |
92 | |
93 return value.get<std::string_view>(); | |
94 } | |
95 | |
88 auto type_traits<std::int8_t>::get(const json& value) -> std::optional<std::int8_t> | 96 auto type_traits<std::int8_t>::get(const json& value) -> std::optional<std::int8_t> |
89 { | 97 { |
90 return clampi<std::int8_t>(value); | 98 return clampi<std::int8_t>(value); |
91 } | 99 } |
92 | 100 |