当前位置:网站首页>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));
```
边栏推荐
猜你喜欢
JDBC prevent SQL injection problems and solutions [preparedstatement]
AAAI 2022 | Peking University & Ali Dharma Institute: pruning and compression of pre training language model based on comparative learning
线性DP AcWing 898. 数字三角形
应用LNK306GN-TL 转换器、非隔离电源
Hash table acwing 840 Simulated hash table
async/await 异步函数
Linear DP acwing 895 Longest ascending subsequence
Execute any method of any class through reflection
js5day(事件监听,函数赋值给变量,回调函数,环境对象this,全选反选案例,tab栏案例)
Openssh remote enumeration username vulnerability (cve-2018-15473)
随机推荐
JSON序列化 与 解析
js1day(输入输出语法,数据类型,数据类型转换,var和let区别)
JDBC 预防sql注入问题与解决方法[PreparedStatement]
Heap acwing 838 Heap sort
2.7 binary tree, post order traversal - [FBI tree]
堆 AcWing 838. 堆排序
软件测试面试题-2022年大厂面试题合集
堆 AcWing 839. 模拟堆
Intel internal instructions - AVX and avx2 learning notes
模块化 CommonJS ES Module
Rust search server, rust quick service finding tutorial
Do you know all the interface test interview questions?
This "little routine" is set on the dough cake of instant noodles. No wonder programmers are always hungry
spfa AcWing 851. spfa求最短路
移动式布局(流式布局)
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
上手报告|今天聊聊腾讯目前在用的微服务架构
接口测试面试题目,你都会了吗?
"As a junior college student, I found out how difficult it is to counter attack after graduation."
JS10day(api 阶段性完结,正则表达式简介,自定义属性,过滤敏感词案例,注册模块验证案例)