c++ twitter: are the pointers inside a unique_ptr<> invalidated on a std::move. Trying to see if bug. Imagine this. auto x = unique_ptr.. return x->future_foo().then([x = std::move(x)]{}); all trivially constructible types have type cast for std::move, so it might be fine...
vs... doing a auto x = unique.. auto raw = x.get() return raw->future_foo().then([x = std::move(x)]{}); how to find the spec if unique underlying pointers are invalidated.
-
-
What do you mean invalidated here? The raw pointer itself won't be touched by the move, but certainly the moved-from unique_ptr will be null after movement (that is guaranteed by the standard). unique_ptr is not trivially constructible (but maybe I misunderstood the last part).
-
std::move does nothing for trivially constructible types. A pointer (int*) is trivially constructible. If you move a container, the impl is free to do nothing to the moved from. The question was if the spec guaranteed invalidating source. I.e: other.ptr=null;
- Još 2 druga odgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.