'Does future in c++ corresponding to promise in javascript?

I am a c++ programmer and tried to study std::future and std::promise these days. When I randomly search some information about future/promise, I found some discussion about future/promise in javascript and promise in javascript has then function. In c++, even though std::future don't have then function now, but some proposal have mentioned it. So, there are two question:

  1. does std::future in c++ corresponding to promise in javascript?
  2. if 1 is true, why they confused future and promise?


Solution 1:[1]

Dynamically-typed languages sometimes combine concepts that are separated in statically-typed languages. A JavaScript promise is basically both a C++ promise and future. The resolve and reject functions in JavaScript roughly correspond to the promise side in C++, and the then function in JavaScript roughly corresponds to the future side in C++.

then also can compose promises in JavaScript, which you might consider a third feature, but in practice futures aren't very useful without composition.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Karl Bielefeldt