0
Is promise future needed ?
We don't have callable function passed to thread returns value. So, Std::ref is the one which helps Other option is using promise which also help to provide us value out of thread function I have used both the approach in below code. Question 1 : So, Why so much complication of promise and future when we can use std::ref easily Question 2 : Is there any other use case of future and promise or is it just unnecessary alternate? Question 3 : Also, future promise is complication as we have to join thread also which is blocking call and future.get is also a blocking call. https://sololearn.com/compiler-playground/cBMoWNzA2Fph/?ref=app
0 ответов