From: Jake hall (jakehall.me_at_[hidden])
Date: 2007-08-23 06:30:06


On Wednesday 22 August 2007 21:18, Jake hall wrote:
> I would like to hear peoples thought on a library i uploaded to the
> vault and maybe get it submitted for review.
> the libraries name is the EventHandler library, it can be found in the
> vault under home / Generic Programming / EventHandler.zip
>
> i find it simple to use (well i wrote it so i should) but effective at
> adding almost .net style events to classes

> I've never used .net events/delegates, but from a google search and a
> subsequent 60 second review of an article on them, they seem to cover the
> same ground as signals/slots. Am I way off base here?

I quickly googled signals/slots and found a website called
http://doc.trolltech.com/3.3/signalsandslots.html
which talkes about a class called "QObject", at the begining of the page
they state there reasons for using
signals/slots, which are ;

doc.trolltech.com wrote:
>Callbacks have two fundamental flaws. Firstly they are not type safe. We
can never be certain that the processing
>function will call the callback with the correct arguments. Secondly the
callback is strongly coupled to the processing
>function since the processing function must know which callback to call.

The EventHandler library enforces a type safety in the callback function
pointers and you can also clone EventHandlers
simply by event_handler<> * event = &anotherevent; so althout you need to
know the function to call it doesnt have to be
specified each time. these features minic (and in areas improve on) the .net
feel of events.