| 290 | } |
| 291 | |
| 292 | template <typename T> void reflectMember(JsonWriter &vis, const char *name, std::optional<T> &v) { |
| 293 | // For TypeScript std::optional property key?: value in the spec, |
| 294 | // We omit both key and value if value is std::nullopt (null) for JsonWriter |
| 295 | // to reduce output. But keep it for other serialization formats. |
| 296 | if (v) { |
| 297 | vis.key(name); |
| 298 | reflect(vis, *v); |
| 299 | } |
| 300 | } |
| 301 | template <typename T> void reflectMember(BinaryWriter &vis, const char *, std::optional<T> &v) { reflect(vis, v); } |
| 302 | |
| 303 | // The same as std::optional |
no test coverage detected