Skip to content

Commit

Permalink
Use DenseMap
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Oct 31, 2024
1 parent 20a3a30 commit 6970896
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Command*, CommandPtr> ownedCommands;
wpi::DenseMap<Command*, CommandPtr> ownedCommands;
};

template <typename TMap, typename TKey>
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 6970896

Please sign in to comment.