Skip to content

Commit

Permalink
fest: add init flag to reflection dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN authored Dec 14, 2023
1 parent 9c08557 commit 3e465e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ll/api/reflection/Dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <type_traits>

namespace ll::reflection {
template <class Storage, std::default_initializable Listener>
template <class Storage, std::default_initializable Listener, bool CallInit = false>
class Dispatcher {
public:
using storage_type = Storage;
Expand All @@ -18,7 +18,9 @@ class Dispatcher {
template <class... Args>
Dispatcher(Args&&... args) : storage(std::forward<Args>(args)...),
listener() {
call();
if constexpr (CallInit) {
call();
}
}
Dispatcher& operator=(Storage const& other) {
storage = other;
Expand Down

0 comments on commit 3e465e8

Please sign in to comment.