如何从 cpprest json 数组中删除元素?我必须创建一个只有我想要的元素的数组的新副本吗?
版本 2.5.0
您可以使用 JSON 数组类内置的功能。 web::json::array 类有两个擦除函数:
iterator web::json::array::erase(iterator position);
void web::json::array::erase(size_type index);
您可以选择最适合您的。
卡萨布兰卡关于擦除的文档: http ://microsoft.github.io/cpprestsdk/classweb_1_1json_1_1array.html#a4d08df9be2e24e1ca6f00d7c07448f0f