I wish to instantiate public members of a class and return it as a promise.
This is what I am trying to do:
class A
{
public:
int x;
};
std::future<A> returnPromiseA(int y)
{
std::promise<A> promise;
promise.x = y; //<- THIS IS INCORECT
return promise;
}
promise.x = y;
is an incorrect syntax.
What is the correct syntax for assignment?