diff --git a/LR35902/fusetest_LR35902/FuseTestSuite.cpp b/LR35902/fusetest_LR35902/FuseTestSuite.cpp index 365b7c0..7570179 100644 --- a/LR35902/fusetest_LR35902/FuseTestSuite.cpp +++ b/LR35902/fusetest_LR35902/FuseTestSuite.cpp @@ -10,13 +10,12 @@ Fuse::TestSuite::TestSuite(std::string path) { void Fuse::TestSuite::run() { auto failedCount = 0; auto unimplementedCount = 0; - for (auto test : m_tests.container()) { + for (const auto& test : m_tests.container()) { - auto key = test.first; + const auto& [key, input] = test; std::cout << "** Checking: " << key << std::endl; - auto input = test.second; - auto result = m_results.container().find(key)->second; + const auto& result = m_results.container().find(key)->second; Fuse::TestRunner runner(input, result); diff --git a/M6502/src/Profiler.cpp b/M6502/src/Profiler.cpp index c2c11a2..1e66c79 100644 --- a/M6502/src/Profiler.cpp +++ b/M6502/src/Profiler.cpp @@ -42,9 +42,8 @@ void EightBit::Profiler::EmitProfileInformation() { { StartingScopeOutput.fire(); - for (auto& scopeCycle : scopeCycles) { - auto name = scopeCycle.first; - auto cycles = scopeCycle.second; + for (const auto& scopeCycle : scopeCycles) { + const auto& [name, cycles] = scopeCycle; auto namedAddress = (size_t)symbols.addresses().find(name)->second; auto count = addressCounts[namedAddress]; ProfileScopeEventArgs event(name, cycles, count); @@ -72,9 +71,8 @@ void EightBit::Profiler::addAddress(uint16_t address, int cycles) { } void EightBit::Profiler::BuildAddressScopes() { - for (auto& label : symbols.labels()) { - auto address = label.first; - auto key = label.second; + for (const auto& label : symbols.labels()) { + const auto& [address, key] = label; auto scope = symbols.scopes().find(key); if (scope != symbols.scopes().end()) { for (uint16_t i = address; i < address + scope->second; ++i) { diff --git a/Z80/fusetest_Z80/FuseTestSuite.cpp b/Z80/fusetest_Z80/FuseTestSuite.cpp index 365b7c0..fc773ec 100644 --- a/Z80/fusetest_Z80/FuseTestSuite.cpp +++ b/Z80/fusetest_Z80/FuseTestSuite.cpp @@ -10,12 +10,11 @@ Fuse::TestSuite::TestSuite(std::string path) { void Fuse::TestSuite::run() { auto failedCount = 0; auto unimplementedCount = 0; - for (auto test : m_tests.container()) { + for (const auto& test : m_tests.container()) { - auto key = test.first; + const auto& [key, input] = test; std::cout << "** Checking: " << key << std::endl; - auto input = test.second; auto result = m_results.container().find(key)->second; Fuse::TestRunner runner(input, result); diff --git a/src/Bus.cpp b/src/Bus.cpp index 812868f..221129a 100644 --- a/src/Bus.cpp +++ b/src/Bus.cpp @@ -30,8 +30,7 @@ void EightBit::Bus::loadHexFile(const std::string path) { IntelHexFile file(path); const auto chunks = file.parse(); for (const auto& chunk : chunks) { - const auto address = chunk.first; - const auto content = chunk.second; + const auto& [address, content] = chunk; const auto mapped = mapping(address); const uint16_t offset = address - mapped.begin; mapped.memory.load(content, offset); diff --git a/src/IntelHexFile.cpp b/src/IntelHexFile.cpp index 7aae45d..4f82866 100644 --- a/src/IntelHexFile.cpp +++ b/src/IntelHexFile.cpp @@ -18,8 +18,10 @@ std::map> EightBit::IntelHexFile::parse() { std::getline(m_file, line); const auto parsed = parse(line); - if (parsed.has_value()) - returned[parsed.value().first] = parsed.value().second; + if (parsed.has_value()) { + const auto& [address, content] = parsed.value(); + returned[address] = content; + } } if (!m_eof)