Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu committed Dec 15, 2024
1 parent ca1a779 commit 8e5be13
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/utils/signal.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#pragma
#pragma once

#include <map>
#include <unordered_map>

template <typename... Args>
class signal_ {
public:
using key_type = unsigned;

template <typename F>
unsigned connect(F f) {
key_type connect(F f) {
++counter;
functors[counter] = f;
return counter;
Expand All @@ -26,6 +28,6 @@ class signal_ {
}

private:
unsigned counter = 0;
std::map<int, std::function<void(Args...)>> functors;
key_type counter = 0;
std::unordered_map<key_type, std::function<void(Args...)>> functors;
};

0 comments on commit 8e5be13

Please sign in to comment.