• Yedidya Feldblum's avatar
    Introduce makePromiseContract · 57b57616
    Yedidya Feldblum authored
    Summary:
    [Folly] Introduce makePromiseContract, for producing a paired promise-and-semi-future or a paired promise-and-future, depending on which overload is invoked.
    
    It is not ideal that a future is gotten from a promise, but only once. Rather, it is ideal that they be created together.
    
    C++17 code may use structured bindings:
    ```lang=c++
    auto [p, f] = makePromiseContract(); // promise with semi-future
    auto [p, f] = makePromiseContract(&e); // promise with future, given executor e
    ```
    
    Reviewed By: LeeHowes
    
    Differential Revision: D7984050
    
    fbshipit-source-id: 52ee5624fde7c48aa0e81243564ad067c6c6919f
    57b57616
FutureTest.cpp 30.8 KB