title: Deferred/Promise pattern in C++
body: <p>I've recently discovered, and fallen in love with, the Deferred/Promise pattern used in jQuery.  It just encapsulates so many async use cases, including the wonderful chaining, filtering ability, that I can't believe I missed it for so long.</p>
  
  <p>I've just finished refactoring my AS3 code to use the excellent CodeCatalyst/promise-as3 library (<a href="https://github.com/CodeCatalyst/promise-as3" rel="nofollow noreferrer">https://github.com/CodeCatalyst/promise-as3</a>), and so started thinking about going back to my C++ code and seeing how I could implement the pattern there.</p>
  
  <p>Before I started coding this myself, I checked to see if it had been done before, and discovered the <code>std::future</code>/<code>std::promise</code> (and boost equivalents), but they are very heavy (they seem use real threads etc, and have a heavy template syntax).</p>
  
  <p>So, my question is: Is there are lightweight, pure C++ implementation of the Deferred/Promise pattern, jQuery-style?</p>
  
  <p>refs:</p>
  
  <ul>
  <li>pattern: <a href="http://en.wikipedia.org/wiki/Futures_and_promises" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Futures_and_promises</a></li>
  <li>jQuery: <a href="http://api.jquery.com/category/deferred-object/" rel="nofollow noreferrer">http://api.jquery.com/category/deferred-object/</a></li>
  <li>AS3: <a href="https://github.com/CodeCatalyst/promise-as3" rel="nofollow noreferrer">https://github.com/CodeCatalyst/promise-as3</a></li>
  <li>Dart: <a href="http://api.dartlang.org/dart_core/Futures.html" rel="nofollow noreferrer">http://api.dartlang.org/dart_core/Futures.html</a></li>
  <li>C++: <a href="http://www.stdthread.co.uk/doc/headers/future/future.html" rel="nofollow noreferrer">http://www.stdthread.co.uk/doc/headers/future/future.html</a></li>
  </ul>