我看到了这篇关于将 json 数组转换为结构向量的帖子。我有一个名为Foo
:
typedef struct Foo {
Foo* SubFoo;
} Foo;
当我尝试这样做时:
void from_json(const nlohmann::json& j, Foo& f) {
j.at("SubFoo").get_to(f.SubFoo);
}
它给了我这个错误:
error: no matching function for call to 'nlohmann::basic_json<>::get_to(Foo*&) const'
j.at("SubFoo").get_to(a.SubFoo);
那么如何从 json 中获取指向值的指针呢?