Inquiring minds want to know this classic question:
What is std::promise?
I'm fairly familiar with the new standard library's
std::thread,std::asyncandstd::futurecomponents (e.g. see this answer), which are straight-forward.However, I cannot quite grasp what
std::promiseis, what it does and in which situations it is best used. The standard document itself doesn't contain a whole lot of information beyond its class synopsis, and neither does just::thread.Could someone please give a brief, succinct example of a situation where an
std::promiseis needed and where it is the most idiomatic solution?

Add a Comment
Comments are closed.