【发布时间】:2020-05-09 21:32:28
【问题描述】:
我看到this 发布了关于将 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 中获取一个指向值的指针呢?
【问题讨论】:
标签: c++ json pointers struct nlohmann-json