From 59592b6fc291c0aa2d28389ba13f6af977bd4692 Mon Sep 17 00:00:00 2001 From: LZY Date: Tue, 25 Apr 2023 09:59:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B7=AF=E5=BE=84=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index ab6545f..7b1145b 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #define K_VISION_DIR "/hard/k_vision" #define AI_VISION_DIR "/hard/ai_vision" @@ -168,7 +169,7 @@ int main(int argc, char* argv[]) { std::cout << "error: K_VISION_DIR is empty" << std::endl; return -1; } - std::vector vec_matched_path; + std::set set_matched_path; std::cout << "info: >>> match file begin <<<" << std::endl; int j = 0; for (auto it:vec_file_name) @@ -188,16 +189,16 @@ int main(int argc, char* argv[]) { auto timestamp = get_file_timestamp(path); if (timestamp >= vec_datetime.front() && timestamp <= vec_datetime.back()) { - vec_matched_path.push_back(path); + set_matched_path.insert(path); } } } std::cout << "info: match progress " << j << "/" << vec_file_name.size() << std::endl; } - std::cout << "info: >>> match file end(" << vec_matched_path.size() << ") <<<" << std::endl; + std::cout << "info: >>> match file end(" << set_matched_path.size() << ") <<<" << std::endl; std::cout << "info: >>> copy file begin <<<" << std::endl; int i = 0; - for (auto it:vec_matched_path) + for (auto it:set_matched_path) { fs::path path(it); auto strName = path.filename().string(); @@ -214,7 +215,7 @@ int main(int argc, char* argv[]) { } if (i % 50 == 0) { - std::cout << "info: copy progress " << i << "/" << vec_matched_path.size() << std::endl; + std::cout << "info: copy progress " << i << "/" << set_matched_path.size() << std::endl; } } std::cout << "info: >>> copy file end(" << i << ") <<<" << std::endl;