From a1d336bf567c6b7d85a7d565f9db358c25f89cd9 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Wed, 19 Jun 2019 18:39:14 +0200 Subject: [PATCH] Pass dir_name by reference Passing dir_name by reference will save a copy constructor. --- dll/local_storage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp index b701b26..78d3060 100644 --- a/dll/local_storage.cpp +++ b/dll/local_storage.cpp @@ -218,7 +218,7 @@ static std::vector get_filenames_recursive(std::string base_pa std::vector lower = get_filenames_recursive(path); output.push_back(File_Data{ dir_name });// Is this needed ? Add folder name to the list of files ? - std::transform(lower.begin(), lower.end(), std::back_inserter(output), [dir_name](File_Data f) {f.name = dir_name + "\\" + f.name; return f;}); + std::transform(lower.begin(), lower.end(), std::back_inserter(output), [&dir_name](File_Data f) {f.name = dir_name + "\\" + f.name; return f;}); } else { File_Data f; f.name = ffd.cFileName; @@ -357,7 +357,7 @@ static std::vector get_filenames_recursive(std::string base_pa path += dir_name; std::vector lower = get_filenames_recursive(path); - std::transform(lower.begin(), lower.end(), std::back_inserter(output), [dir_name](File_Data f) {f.name = dir_name + "/" + f.name; return f;}); + std::transform(lower.begin(), lower.end(), std::back_inserter(output), [&dir_name](File_Data f) {f.name = dir_name + "/" + f.name; return f;}); } } }