C ++-JSON :: Value用作函数参数中的引用

如何在函数中使用带有指针的JSON :: Value?

更新:

string sign_pkcs(int tab)
{
    Json::Value json_output;
    json_output["tab"] = tab;

    add_to_json_string(&json_output,"find_certificate_object","Find certificate successfully!");


    >> This is using from json_output

    return ...
}

void add_to_json_string(Json::Value *jsonInput,string key,string value)
{
    *jsonInput[key] = value;
}

但我收到错误消息:

Error (active)  E0349   no operator "[]" matches these operands

我想在代码的每一步中将其他函数的任何键和值添加到一个JSON变量中。

asdg85171683 回答:C ++-JSON :: Value用作函数参数中的引用

[]的优先级高于*,因此您需要执行(*jsonInput)[key]

本文链接:https://www.f2er.com/3168574.html

大家都在问