aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Json.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-07-20 13:06:22 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-07-20 13:06:22 +0200
commit595606ca4ed3011af19c6d8a9f95519d84320120 (patch)
tree1f816921f27cce2e98ba7b61da7b68f1c269dd19 /lib/Json.h
parent2de7bab3cf1c7757078a113b35e927ecbccc5e3d (diff)
downloaddabmod-595606ca4ed3011af19c6d8a9f95519d84320120.tar.gz
dabmod-595606ca4ed3011af19c6d8a9f95519d84320120.tar.bz2
dabmod-595606ca4ed3011af19c6d8a9f95519d84320120.zip
Rework Json so that it works with map that doesn't support incomplete types
Diffstat (limited to 'lib/Json.h')
-rw-r--r--lib/Json.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Json.h b/lib/Json.h
index ee67f35..706394f 100644
--- a/lib/Json.h
+++ b/lib/Json.h
@@ -41,11 +41,12 @@
namespace json {
- using map_t = std::unordered_map<std::string, struct value_t>;
+ // STL containers are not required to support incomplete types,
+ // hence the shared_ptr
struct value_t {
std::variant<
- map_t,
+ std::shared_ptr<std::unordered_map<std::string, value_t>>,
std::string,
double,
size_t,
@@ -54,5 +55,7 @@ namespace json {
std::nullopt_t> v;
};
+ using map_t = std::unordered_map<std::string, value_t>;
+
std::string map_to_json(const map_t& values);
}