fixup! feat: add tr_strvPath() (#2134) (#2156)

fix: -Wshadow warning in tr_strvPath()
This commit is contained in:
Charles Kerr 2021-11-14 13:53:58 -06:00 committed by GitHub
parent 932a72e61d
commit 10d3cdb99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -271,17 +271,17 @@ std::string tr_strvPath(T... args)
auto setme = std::string{};
auto const n_args = sizeof...(args);
auto const n = n_args + (std::size(std::string_view{ args }) + ...);
if (setme.capacity() < n)
{
setme.reserve(n);
}
auto const foo = [](std::string& setme, std::string_view a)
auto const foo = [&setme](std::string_view a)
{
setme += a;
setme += TR_PATH_DELIMITER;
};
(foo(setme, args), ...);
(foo(args), ...);
setme.resize(setme.size() - 1);
return setme;
}