Just a quick note: I feel like I’ve accomplished a lot today just because I READ this article. Nice bomb drop. We’ll see what I do with it… I think it’s a bit too crunchy to put into use – I don’t feel like dealing with any gotchas on all the versions of all the compilers I’m using, as there are a LOT these days. But it has lead me to research other progress in the C++ standard. The boost function library, which has been accepted into TR1, is already available in some compiler spaces, whoop.
I started down this path because I wanted to store a predicate function in my sorted_vector class. For now I can get by without this stuff, always passing in a functor to the function calls that need it, but that’s not as elegant.
Meanwhile, it’s upwards and onwards with QT slots and signals – QT is getting the job done for me in a major way. There are boost::signal and boost::bind as alternatives to that, but I’m really kicking out the jams with QT, so I’m not stopping now. More to come soon, hopefully.
UPDATE: C++0x is hopefully coming soon. Wikipedia, as usual, gives a nice overview and some nice guidance. In particular, I need to avoid std::auto_ptr and function object base classes (std::unary_function, std::binary_function) which are slated for removal(!). Sounds like I need to keep my eye out for polymorphic wrappers for function objects, they may be just the ticket I need. Check out the whole standard, it’s juicy! :>
UPDATE 2: Here is a nice rundown of options for the sort predicate function, leading into the C++0x solution.