From 84d9385061a50a1a726a0436224d46a91b877a60 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 18 May 2023 07:51:23 +0100 Subject: [PATCH] Declared const to quieten cppcheck eronous warning --- src/vsg/ui/Keyboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vsg/ui/Keyboard.cpp b/src/vsg/ui/Keyboard.cpp index 62f687b28..60658ed27 100644 --- a/src/vsg/ui/Keyboard.cpp +++ b/src/vsg/ui/Keyboard.cpp @@ -79,7 +79,7 @@ bool Keyboard::pressed(KeySymbol key, bool ignore_handled_keys) const auto itr = keyState.find(key); if (itr == keyState.end()) return false; - auto& keyHistory = itr->second; + const auto& keyHistory = itr->second; if (keyHistory.timeOfKeyRelease != keyHistory.timeOfFirstKeyPress) { return false; @@ -97,7 +97,7 @@ std::pair Keyboard::times(KeySymbol key, bool ignore_handled_key auto currentTime = clock::now(); - auto& keyHistory = itr->second; + const auto& keyHistory = itr->second; if (keyHistory.timeOfKeyRelease != keyHistory.timeOfFirstKeyPress) { return {std::chrono::duration(currentTime - keyHistory.timeOfFirstKeyPress).count(),