diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp index 6c09d0f6127..a9cb3028eab 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp @@ -67,7 +67,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 +182,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); }