diff --git a/src/sled/experimental/design_patterns/dispatcher.h b/src/sled/experimental/design_patterns/dispatcher.h index 53871df..46d9f78 100644 --- a/src/sled/experimental/design_patterns/dispatcher.h +++ b/src/sled/experimental/design_patterns/dispatcher.h @@ -4,6 +4,7 @@ #include "sled/synchronization/mutex.h" #include #include +#include namespace sled { namespace experimental { @@ -11,12 +12,13 @@ namespace experimental { template class Dispatcher { public: + static_assert(!std::is_rvalue_reference::value, "must be a value type"); enum class DispatchResult { kHandled, kNotFound }; struct Handler { virtual ~Handler() = default; virtual bool HandleMessage(const T &) = 0; - virtual bool OnMessage(T &&) = 0; + virtual bool OnMessage(const T &) = 0; }; virtual ~Dispatcher() = default; diff --git a/src/sled/sled.h b/src/sled/sled.h index 515a236..1ba8602 100644 --- a/src/sled/sled.h +++ b/src/sled/sled.h @@ -9,6 +9,9 @@ namespace async {} #include "inja.hpp" #include "rx.h" +// experimental +#include "sled/experimental/design_patterns/dispatcher.h" + // event_bus #include "sled/event_bus/event_bus.h"