We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
JsonExporter::fromJson
1 parent 2584aec commit b425c91Copy full SHA for b425c91
include/behaviortree_cpp/json_export.h
@@ -39,10 +39,18 @@ class JsonExporter{
39
dst = val;
40
}
41
42
+ /**
43
+ * @brief fromJson tries to convert arbitrary JSON data into the type T.
44
+ *
45
+ * Calls only compile if `nlohmann::from_json(const nlohmann::json&, T&)` is
46
+ * defined in T's namespace.
47
+ */
48
template <typename T>
49
T fromJson(const nlohmann::json& src) const
50
{
- // TODO: Implement a similar "converter" interface as toJson.
51
+ // We don't need to implement a similar `type_converters` interface as
52
+ // `toJson` here because the type T must be know statically. There is no
53
+ // opaque BT::Any wrapper here requiring RTTI.
54
return src.template get<T>();
55
56
0 commit comments