Fix unnecessary-copy-initialization

> warning: the variable 'key' is copy-constructed from a const reference but is
only used as const reference; consider making it a const reference
[performance-unnecessary-copy-initialization]

Found by clang-tidy.
This commit is contained in:
jvoisin 2022-01-04 20:42:09 +01:00
parent b6572fbe42
commit 421e6629ad
5 changed files with 7 additions and 7 deletions

View file

@ -11,7 +11,7 @@ namespace DetourNavigator
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
if (!navMesh)
return std::nullopt;
const auto settings = navigator.getSettings();
const auto& settings = navigator.getSettings();
const auto result = DetourNavigator::findRandomPointAroundCircle(navMesh->lockConst()->getImpl(),
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
toNavMeshCoordinates(settings.mRecast, maxRadius), includeFlags, settings.mDetour);
@ -26,7 +26,7 @@ namespace DetourNavigator
const auto navMesh = navigator.getNavMesh(agentHalfExtents);
if (navMesh == nullptr)
return std::nullopt;
const auto settings = navigator.getSettings();
const auto& settings = navigator.getSettings();
const auto result = DetourNavigator::raycast(navMesh->lockConst()->getImpl(),
toNavMeshCoordinates(settings.mRecast, agentHalfExtents), toNavMeshCoordinates(settings.mRecast, start),
toNavMeshCoordinates(settings.mRecast, end), includeFlags, settings.mDetour);

View file

@ -70,7 +70,7 @@ void ESMReader::resolveParentFileIndices(const std::vector<ESMReader>& allPlugin
const ESMReader& reader = allPlugins.at(i);
if (reader.getFileSize() == 0)
continue; // Content file in non-ESM format
const std::string candidate = reader.getName();
const std::string& candidate = reader.getName();
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
index = i;