
On Sat, Sep 25, 2010 at 21:04, Gwenio <urulokiurae@gmail.com> wrote:
[...] enum events { // contains ids for events that can be stored with the "set" function };
This approach is intrinsically not extensible. You should be able to attach arbitrary events, probably identified by 'event_type' - an objects holding the information about the event.
template<class Func,events evt> void set(Func f); // Sets how to handle a specific type of event
set() function allows attaching event handlers at run-time, however I'm not sure this is a correct approach. Maybe generating a table at compile time would be better. This is the static vs dynamic dilemma. As a C++ programmer I honor the static approach. Q: Who owns control_event_handler? Is it O(NM) or O(N+M) approach? It looks like O(NM) because you perform a call on f without specifying the target of the event. As a O(NM) I'm not going to use it.