当前位置:网站首页>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));
```
边栏推荐
- Post request body content cannot be retrieved repeatedly
- Typora+docsify quick start
- 1380. Lucky numbers in the matrix [two-dimensional array, matrix]
- Docker-compose配置Mysql,Redis,MongoDB
- Writing method of then part in drools
- When uploading a file, the server reports an error: iofileuploadexception: processing of multipart / form data request failed There is no space on the device
- 堆 AcWing 838. 堆排序
- Distributed machine learning framework and high-dimensional real-time recommendation system
- Fluent fluent library encapsulation
- Rust search server, rust quick service finding tutorial
猜你喜欢
随机推荐
哈希表 AcWing 841. 字符串哈希
Go学习笔记—多线程
Rust search server, rust quick service finding tutorial
Win10 system OmniPeek wireless packet capturing network card driver failed to install due to digital signature problem solution
单指令多数据SIMD的SSE/AVX指令集和API
线性DP AcWing 898. 数字三角形
Redis transaction mechanism implementation process and principle, and use transaction mechanism to prevent inventory oversold
High performance erasure code coding
PR 2021 quick start tutorial, learn about the and functions of the timeline panel
JSON序列化 与 解析
1380. Lucky numbers in the matrix [two-dimensional array, matrix]
About asp Net MVC project in local vs running response time is too long to access, the solution!
How to write a pleasing English mathematical paper
spfa AcWing 852. spfa判断负环
bellman-ford AcWing 853. 有边数限制的最短路
Heap (priority queue)
Sub thread get request
Use MySQL events to regularly perform post seven world line tasks
Leetcode - Sword finger offer 37, 38
Is the neural network (pinn) with embedded physical knowledge a pit?

![[ybtoj advanced training guidance] judgment overflow [error]](/img/be/bbe357ac2f2a8839afc5af47db88d0.jpg)





