Skip to content

Commit

Permalink
use list instead of map to keep order
Browse files Browse the repository at this point in the history
  • Loading branch information
JSchoeberl committed Jan 18, 2024
1 parent 5a4b89c commit eb90c6e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libsrc/core/signal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,22 @@ namespace ngcore
class SimpleSignal
{
private:
std::map<void*,std::function<void()>> funcs;
// std::map<void*,std::function<void()>> funcs;
std::list<std::pair<void*,std::function<void()>>> funcs;
public:
SimpleSignal() = default;

template<typename FUNC>
void Connect(void* var, FUNC f)
{
funcs[var] = f;
// funcs[var] = f;
funcs.push_back ( { var, f } );
}

void Remove(void* var)
{
funcs.erase(var);
// funcs.erase(var);
funcs.remove_if([&] (auto var_f) { return var_f.first==var; });
}

inline void Emit()
Expand Down

0 comments on commit eb90c6e

Please sign in to comment.