Ver Fonte

Range-for loop with const reference

Prevent copy-ctor and dtor to be called.
Found by Cppcheck (constVariableReference)
Christoph Grüninger há 1 ano atrás
pai
commit
01c22dfaee
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      Tests/CMakeLib/testDebuggerNamedPipe.cxx

+ 1 - 1
Tests/CMakeLib/testDebuggerNamedPipe.cxx

@@ -194,7 +194,7 @@ int runTest(int argc, char* argv[])
     R"("command" *: *"disconnect".*"success" *: *true.*"type" *: *"response")"
   };
 
-  for (auto& regexString : expectedResponses) {
+  for (const auto& regexString : expectedResponses) {
     cmsys::RegularExpression regex(regexString);
     if (!regex.find(debuggerResponse)) {
       std::cout << "Expected response not found: " << regexString << std::endl;