How to pass a struct (e.g. struct A) that contains a std::promise between threads by using std::promise and std::future?
Actually,the struct A contains a std::funtion toExecute
,std::any result
and std::promise<A> p
.
I want to set “result” to the return value of “toExecute” and then pass this struct back to main thread by using “p”.