Skip to content

Commit 7cdffa9

Browse files
mizdebskmkoncek
authored andcommitted
Avoid unnecessary temp object in emplace_back
Refactor emplace_back usage to pass constructor arguments directly, eliminating the creation of a temporary Path_origin_entry object. This allows the object to be constructed in-place within the vector.
1 parent f3775cb commit 7cdffa9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/jurand.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Usage: jurand [optional flags] <matcher>... [file path]...
7575

7676
if (std::filesystem::is_regular_file(to_handle) and not std::filesystem::is_symlink(to_handle))
7777
{
78-
files.emplace_back(Path_origin_entry(std::move(to_handle), fileroot));
78+
files.emplace_back(std::move(to_handle), fileroot);
7979
}
8080
else if (std::filesystem::is_directory(to_handle))
8181
{
@@ -87,7 +87,7 @@ Usage: jurand [optional flags] <matcher>... [file path]...
8787
and not std::filesystem::is_symlink(to_handle)
8888
and to_handle.native().ends_with(".java"))
8989
{
90-
files.emplace_back(Path_origin_entry(std::move(to_handle), fileroot));
90+
files.emplace_back(std::move(to_handle), fileroot);
9191
}
9292
}
9393
}

0 commit comments

Comments
 (0)