lundi 4 janvier 2016

tink_core Future (haxe) form c++

In haxe there is a library called tink core which supplies so called "Futures".

A Future is a value, that is not yet calculated (the result of an asynchronous operation for example).

Among other things, I can do the following things with a Future:

  • call map with a function that modifies the value, to create a new future with the modified value
  • call first with two futures, to create a new future with the value of the future that finishes first
  • Add a callback to the future, that will be called when the value is available.

Now in C++ there is std::future, but I do not see that the operations described above are possible with it.

Also, it seems that std::future can only be created with std::async. But I want to create futures in my own way, without a function callback.

So my question:

  • Am I misjudging std::future, and it can do all of this?
  • Is there a different future library in c++ I have not found and that can do this?

Aucun commentaire:

Enregistrer un commentaire