From b02dfe41b255ac663c3ac3a4475a4933186de1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 8 May 2021 13:37:31 +0200 Subject: FRP: use BhvComp memoized value only if not dirty --- include/erebos/frp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/erebos') diff --git a/include/erebos/frp.h b/include/erebos/frp.h index 466da33..8014536 100644 --- a/include/erebos/frp.h +++ b/include/erebos/frp.h @@ -87,6 +87,8 @@ protected: virtual bool needsUpdate(const BhvCurTime &) const; virtual void doUpdate(const BhvCurTime &); + bool isDirty(const BhvCurTime &) const { return dirty; } + vector>> watchers; private: void markDirty(const BhvCurTime &, vector> &); @@ -222,7 +224,7 @@ public: { x = g.impl->get(ctime, f.impl->get(ctime, monostate())); } C get(const BhvCurTime & ctime, const monostate & m) const override - { return x ? x.value() : g.impl->get(ctime, f.impl->get(ctime, m)); } + { return x && !BhvImplBase::isDirty(ctime) ? x.value() : g.impl->get(ctime, f.impl->get(ctime, m)); } private: BhvFun f; -- cgit v1.2.3