|
16 | 16 |
|
17 | 17 | #include <fstream> |
18 | 18 |
|
19 | | - |
20 | | -//// partial specialization (full specialization works too) |
21 | | -//NLOHMANN_JSON_NAMESPACE_BEGIN |
22 | | -//template <typename T> |
23 | | -//struct adl_serializer<std::optional<T>> { |
24 | | -// static void to_json(json& j, const std::optional<T>& opt) { |
25 | | -// if (opt == std::nullopt) { |
26 | | -// j = nullptr; |
27 | | -// } else { |
28 | | -// j = *opt; // this will call adl_serializer<T>::to_json which will |
29 | | -// // find the free function to_json in T's namespace! |
30 | | -// } |
31 | | -// } |
32 | | - |
33 | | -// static void from_json(const json& j, std::optional<T>& opt) { |
34 | | -// if (j.is_null()) { |
35 | | -// opt = std::nullopt; |
36 | | -// } else { |
37 | | -// opt = j.template get<T>(); // same as above, but with |
38 | | -// // adl_serializer<T>::from_json |
39 | | -// } |
40 | | -// } |
41 | | -//}; |
42 | | -//NLOHMANN_JSON_NAMESPACE_END |
43 | | - |
44 | | - |
45 | 19 | using json = nlohmann::json; |
46 | 20 | namespace fs = std::filesystem; |
47 | 21 | using namespace oklt::tests; |
@@ -120,11 +94,9 @@ struct TranspileActionConfig { |
120 | 94 | std::vector<std::string> mutable defs; |
121 | 95 | std::filesystem::path launcher; |
122 | 96 | std::optional<std::string> intrinsic = std::nullopt; |
123 | | - //NLOHMANN_DEFINE_TYPE_INTRUSIVE(TranspileActionConfig, backend, source, includes, defs, launcher, intrinsic) |
124 | 97 | oklt::UserInput build(const fs::path& dataDir) const; |
125 | 98 | }; |
126 | 99 |
|
127 | | -// void to_json(nlohmann::json& json, const TranspileActionConfig& dt); |
128 | 100 | void from_json(const json& j, TranspileActionConfig& conf) { |
129 | 101 |
|
130 | 102 | j.at("backend").get_to(conf.backend); |
|
0 commit comments