C
Chris Morley
Hi, I have always done my C++ class callbacks with the age old 'using this
pointer in parameter of the class's static callback function' and
typecasting it to get the specific instance.
However I'm left wondering are there any better ways of doing this?
Just before I left work today I came across functors, which look promising.
I will have a proper look tomorrow, but I have a few questions in the mean
time.
Is it possible to use functor classes with standard, precompiled, c style
callback code, passing them in as pointers? Or do I need to pass a pointer
to the base class of the translating class and have to recompile code in
order for the derefencing to work?
I'm going to have a look online now for some examples whereby callbacks are
made compile time safe, in the meantime (and indeed if I cant find any), can
anyone recommend some good examples?
Many thanks in advance,
Chris
pointer in parameter of the class's static callback function' and
typecasting it to get the specific instance.
However I'm left wondering are there any better ways of doing this?
Just before I left work today I came across functors, which look promising.
I will have a proper look tomorrow, but I have a few questions in the mean
time.
Is it possible to use functor classes with standard, precompiled, c style
callback code, passing them in as pointers? Or do I need to pass a pointer
to the base class of the translating class and have to recompile code in
order for the derefencing to work?
I'm going to have a look online now for some examples whereby callbacks are
made compile time safe, in the meantime (and indeed if I cant find any), can
anyone recommend some good examples?
Many thanks in advance,
Chris