E0349:使用 nlohmann-json 使用 JSON 时,没有运算符“=”匹配这些操作数

问题描述

我在 Visual Studio 上的 C++ 项目中使用 nlohmann-json,但发现了一个错误

E0349:no operator "=" matches these operands

在下面的代码:

#include <nlohmann/json.hpp>
using json = nlohmann::json;


void myFunc(unsigned int** arr) {
    json j;
    j["myArr"] = arr;//E0349:no operator "=" matches these operands
}

怎么了?

另一方面,当我尝试以下方法时,它起作用了。

void myFunc(unsigned int** arr) {
    json j;
    j["myArr"] = {1,2,3};// no error
}

我猜这归因于数据类型问题。

我希望得到任何信息。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)