Mike wrote: > True, templatizing the entire Widget class would cause code bloat > which is why one would be mad to do it. It is possible to implement > the template m/f I suggested without templatizing the whole widget > class. For example: >
I implemented a replacement for the fltk callback mechanism a few years ago called fl_connect: http://cscdev.lvc.edu/fl_connect I haven't maintained that website in awhile (apologies), but the code ports without problems to fltk-1.1.x (I've patched v1.1.8, for instance). My solution uses templates, but doesn't templatize Widget; a template function creates the static forwarding functions for you, so user code looks nice. I avoided template member functions out of fear of old compilers. Such concerns are very important to the FLTK team. I did some tests back in the day, and found essentially no performance penalty and no code bloat (the template mechanism essentially writes the same code you would have to write, anyway, if you were to use member function callbacks). The use of templates here carries no downside. I will try to find time to port my solution to 1.3, but it will be awhile (2 months?) before that can happen. Ken -- Ken Yarnall Dept. of Mathematical Sciences Lebanon Valley College Assoc. Professor of Math and CS (717)867-6085 yarn...@lvc.edu _______________________________________________ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev