我正在使用 toml++。如何在 C++ 中使用 toml++ 修改 TOML 文件的特定值。
json ConfigService::getAllData(std::string filePath)
{
try
{
auto _data_table = toml::parse_file(filePath);
_data_table["config_paths"]["DIAAI_core"] = "diaaiSetting.toml"; # this is not working
cout << _data_table << endl;
}
catch (const exception err)
{
std::cerr << "Parsing failed:\n"
<< err.what() << "\n";
std::runtime_error(err.what());
}
}
追踪回溯
error: no match for ‘operator=’ (operand types are ‘toml::v3::node_view<toml::v3::node>’ and ‘int’)
51 | _data_table["config_paths"] = 1;