I've been reading the C++11 spec, and I'm having trouble understanding the result of one of the std::promise
object operators ( std::promise& operator=(std::promise&& rhs) noexcept
).
The spec says the effect is "Abandons any shared state and then as if promise(std::move(rhs)).swap(*this)
."
I get that *this
will equal the previous value of rhs
, but what is the effect on rhs
?
promise& operator=(promise&& rhs)
tranfers the ownership of the std::promise
from one object to another. After the assigment rhs
has no associated async result, and *this
has the one rhs
had before (if any).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.