C++ Futures and Promises

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Promises and Futures are used to ferry a single object from one thread to another.

A std::promise object is set by the thread which generates the result.

A std::future object can be used to retrieve a value, to test to see if a value is available, or to halt execution until the value is available.



Got any C++ Question?