mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
use list instead of map to keep order
This commit is contained in:
parent
5a4b89c1ed
commit
eb90c6ed3b
@ -51,19 +51,22 @@ namespace ngcore
|
|||||||
class SimpleSignal
|
class SimpleSignal
|
||||||
{
|
{
|
||||||
private:
|
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:
|
public:
|
||||||
SimpleSignal() = default;
|
SimpleSignal() = default;
|
||||||
|
|
||||||
template<typename FUNC>
|
template<typename FUNC>
|
||||||
void Connect(void* var, FUNC f)
|
void Connect(void* var, FUNC f)
|
||||||
{
|
{
|
||||||
funcs[var] = f;
|
// funcs[var] = f;
|
||||||
|
funcs.push_back ( { var, f } );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove(void* var)
|
void Remove(void* var)
|
||||||
{
|
{
|
||||||
funcs.erase(var);
|
// funcs.erase(var);
|
||||||
|
funcs.remove_if([&] (auto var_f) { return var_f.first==var; });
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Emit()
|
inline void Emit()
|
||||||
|
Loading…
Reference in New Issue
Block a user