Dave Rahardja wrote:
> Ah, the classical polymorphic event queue problem! The use of RTTI in
> this case is not only messy (as you have discovered), it is also
> _very_ expensive in the run-time domain, as each event will take on
> average N/2 dynamic_cast's to determine what event it actually is
> (where N is the total number of event classes). If you receive
> several thousand messages per second (typical for a GUI), the lookup
> overhead will be significant.
>
> I suspect what you want is an event _interface_:
>
> class some_display_event
> {
> public:
> virtual void do() = 0; // pure virtual
> };
Dave, thanks very much. In the mean time I've come to the same solution
for my other problem (graphic primitive list) and you won't believe
this - my interface has the same do() function
I have afterthoughts in this case as I don't want the user interface to
know how events are implemented but it might work if I keep the header
clean.
--
Regards,
Karel Miklav