当前位置:网站首页>Std:: vector batch import fast de duplication method
Std:: vector batch import fast de duplication method
2022-07-02 12:46:00 【As the deer 】
Destination array 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);
// This is too slow no
/*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));
```
边栏推荐
- 百款拿来就能用的网页特效,不来看看吗?
- Hash table acwing 840 Simulated hash table
- 哈希表 AcWing 841. 字符串哈希
- 移动式布局(流式布局)
- Rust语言文档精简版(上)——cargo、输出、基础语法、数据类型、所有权、结构体、枚举和模式匹配
- Redis transaction mechanism implementation process and principle, and use transaction mechanism to prevent inventory oversold
- Deep Copy Event bus
- Typora+docsify quick start
- The coloring method determines the bipartite graph acwing 860 Chromatic judgement bipartite graph
- Oracle从入门到精通(第4版)
猜你喜欢

Less than three months after the programmer was hired, the boss wanted to launch the app within one month. If he was dissatisfied, he was dismissed immediately

Browser node event loop

Js8day (rolling event (scroll family), offset family, client family, carousel map case (to be done))

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

面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六

js3day(数组操作,js冒泡排序,函数,调试窗口,作用域及作用域链,匿名函数,对象,Math对象)

Direct control PTZ PTZ PTZ PTZ camera debugging (c)

js4day(DOM开始:获取DOM元素内容,修改元素样式,修改表单元素属性,setInterval定时器,轮播图案例)

移动式布局(流式布局)

Interview with meituan, a 34 year old programmer, was rejected: only those under the age of 30 who work hard and earn little overtime
随机推荐
This "little routine" is set on the dough cake of instant noodles. No wonder programmers are always hungry
Typora+docsify quick start
深拷贝 事件总线
Interview questions for software testing - a collection of interview questions for large factories in 2022
BOM DOM
哈希表 AcWing 841. 字符串哈希
深拷貝 事件總線
Use MySQL events to regularly perform post seven world line tasks
2.6 using recursion and stack - [tower of Hanoi problem]
bellman-ford AcWing 853. Shortest path with side limit
spfa AcWing 851. spfa求最短路
基于STM32的OLED 屏幕驱动
js 迭代器 生成器 异步代码处理 promise+生成器 -> await/async
. Net wechat message template push
The second composition template of postgraduate entrance examination English / chart composition, English chart composition is enough
Do you know all the interface test interview questions?
Wechat official account payment prompt MCH_ ID parameter format error
线性DP AcWing 898. 数字三角形
面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六
Linear DP acwing 897 Longest common subsequence