use list instead of map to keep order

This commit is contained in:
Joachim Schoeberl 2024-01-18 19:43:08 +01:00
parent 5a4b89c1ed
commit eb90c6ed3b

View File

@ -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()