当前位置:网站首页>std::vector批量导入快速去重方法
std::vector批量导入快速去重方法
2022-07-02 09:45:00 【如鹿渴慕泉水】
目的数组std::vector searchapp
inline bool has_scan_impl(const stSWLIST& app1, const stSWLIST& app2)
{
bool cond = app1.path == app2.path;
return cond;
}
const std::string fl =filename
std::ifstream ifs(fl, ios_base::in);
if (ifs.is_open())
{
std::string retbuf;
std::copy(std::istreambuf_iterator<char>{ifs}, std::istreambuf_iterator<char>{},
std::back_inserter(retbuf));
ifs.close();
cJSON* lpNode = cJSON_Parse(retbuf.c_str());
int iSize = cJSON_GetArraySize(lpNode);
std::vector<stSWLIST> searchapp2;
for (int index = 0; index < iSize; index++)
{
cJSON* lpArayNode = cJSON_GetArrayItem(lpNode, index);
stSWLIST filedump = json2app(lpArayNode);
searchapp2.push_back(filedump);
//这个太慢不用了
/*if (add_scan(filedump)) {
continue;
}*/
}
std::vector<stSWLIST> searchappdel;
std::copy(std::find_if(searchapp.begin(), searchapp.end(), [searchapp2](const stSWLIST& app1)
{
return std::find_if(searchapp2.begin(), searchapp2.end(), [app1](const stSWLIST& app2)
{
return has_scan_impl(app1, app2);
}) != searchapp2.end();
}) , searchapp.end(),std::back_inserter(searchappdel));
searchapp.erase(std::remove_if(searchapp.begin(), searchapp.end(), [searchappdel](const stSWLIST& app1)
{
return std::find_if(searchappdel.begin(), searchappdel.end(), [app1](const stSWLIST& app2)
{
return has_scan_impl(app1, app2);
}) != searchappdel.end();
}), searchapp.end());
std::copy(searchapp2.begin(), searchapp2.end(), std::back_inserter(searchapp));
```
边栏推荐
- 考研英语二大作文模板/图表作文,英语图表作文这一篇就够了
- Window10 upgrade encountered a big hole error code: 0xc000000e perfect solution
- 1380. Lucky numbers in the matrix [two-dimensional array, matrix]
- H5 to app
- 上传文件时,服务器报错:IOFileUploadException: Processing of multipart/form-data request failed. 设备上没有空间
- Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
- Use MySQL events to regularly perform post seven world line tasks
- 软件测试面试题-2022年大厂面试题合集
- Heap (priority queue)
- Sort---
猜你喜欢

线性DP AcWing 897. 最长公共子序列

染色法判定二分图 AcWing 860. 染色法判定二分图

drools动态增加、修改、删除规则

In development, why do you find someone who is paid more than you but doesn't write any code?

BOM DOM

AAAI 2022 | Peking University & Ali Dharma Institute: pruning and compression of pre training language model based on comparative learning

线性DP AcWing 895. 最长上升子序列

堆 AcWing 839. 模拟堆

Anti shake throttle

Use sqoop to export ads layer data to MySQL
随机推荐
[old horse of industrial control] detailed explanation of Siemens PLC TCP protocol
Use sqoop to export ads layer data to MySQL
浏览器存储方案
Redis sentinel mechanism and configuration
Map and set
Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
中国交通标志检测数据集
Interview with meituan, a 34 year old programmer, was rejected: only those under the age of 30 who work hard and earn little overtime
染色法判定二分图 AcWing 860. 染色法判定二分图
Find the common ancestor of any two numbers in a binary tree
堆 AcWing 838. 堆排序
Redis transaction mechanism implementation process and principle, and use transaction mechanism to prevent inventory oversold
arcgis js 4. Add pictures to x map
哈希表 AcWing 841. 字符串哈希
LeetCode—剑指 Offer 59 - I、59 - II
. Net, C # basic knowledge
Drools dynamically add, modify, and delete rules
计算二叉树的最大路径和
Anxiety of a 211 programmer: working for 3 years with a monthly salary of less than 30000, worried about being replaced by fresh students
Direct control PTZ PTZ PTZ PTZ camera debugging (c)