From 240b5cc75206b3ba136fbd0b27c330e0d7422fff Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Wed, 30 Oct 2024 22:50:15 -0400 Subject: [PATCH] Use DenseMap --- .../src/main/native/cpp/frc2/command/CommandScheduler.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp index 6c09d0f6127..def91d64879 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -67,7 +66,7 @@ class CommandScheduler::Impl { // Map of Command* -> CommandPtr for CommandPtrs transferred to the scheduler // via Schedule(CommandPtr&&). These are erased (destroyed) at the very end of // the loop cycle when the command lifecycle is complete. - std::unordered_map ownedCommands; + wpi::DenseMap ownedCommands; }; template @@ -182,7 +181,7 @@ void CommandScheduler::Schedule(const CommandPtr& command) { void CommandScheduler::Schedule(CommandPtr&& command) { auto ptr = command.get(); - m_impl->ownedCommands.emplace(ptr, std::move(command)); + m_impl->ownedCommands.try_emplace(ptr, std::move(command)); Schedule(ptr); }