
The question of whether anyone had developed a C++ implementation of Twisted's Deferreds has cropped up on this list several times over the last few years. To date, I've unfortunately been forced to sit on an implementation I developed several years ago for the Department of Defense. Due to some rather draconian IP & security policies, it's taken an exceptionally long time to get the code released. I'm happy to announce though that I finally managed to obtain release authorization for it and that the code now has a new home on Sourceforge. As C++ has differing language features, the API of the C++ deferreds isn't identical to those of Twisted's but most of the key concepts mapped over pretty well. Additionally, this implementation has a few design extensions to facilitate the development multi-threaded C++ applications. The multi-threaded aspect grew almost accidentally out of the original single-threaded design but, since then, it has proven to be extraordinarily useful for simplifying several multi-threaded applications I've worked on. The implementation of the library is, however, rather complex. In large part, this is due to the effort required to work around the inherent inflexibility of the C++ type system. The Function, Bind, and Meta-Programming libraries found in Boost have gone a long way towards simplify the implementation though (my original Loki-based attempt was almost incomprehensible even to me ;-). The library is fully documented though so as long as you're reasonably comfortable with C++ templates, it should be understandable. So far, the library has only been exposed to a handful of individuals for review. I'd be interested to hear the comments anyone has about the design and/or implementation approach. The code is available at: http://deferred.svn.sourceforge.net/viewvc/deferred/ Cheers, Tom