Andre Poenitz ha scritto:
I mean, something like GuiView::doWhenIdle(this, &myMethod):
template<class T> static GuiView::doWhenIdle(T *, bool (T::*)(void))
[I am not sure about the utility of this approach. No need to
proactively introduce funny template constructs ;-}]
The utility comes if the mechanism is potentially useful for other
classes, for other purposes
(not only for BufferView for my specific purpose). Any class that needs
to be called
back could use it with a simple call like the one of above, confined in
the implementation
file (basically it's a functor approach, and, yes, probably there's
smth. in STL that does that).
The alternative to templates, of course, is introduction of a common
base interface (class),
what is also "invasive" in that it forces the user class to inherit from
the interface.
T.
Any drawbacks with such an approach (I know there
is a support/timer.h class,
Yes, that's the thirteenth wheel of our cart...
but guess it cannot know when the GUI is idle).
Andre'