Lines from a book:
The following example shows the use of std::move to transfer ownership of a dynamic object into a thread:
void process_big_object(std::unique_ptr<big_object>); std::unique_ptr<big_object> p(new big_object); p->prepare_data(42); std::thread t(process_big_object,std::move(p));By specifying
std::move(p)in thestd::threadconstructor, the ownership of thebig_objectis transferred first into internal storage for the newly created thread and then intoprocess_big_object.
I understand stack and heap; any idea, what actually is this internal storage ?
Aucun commentaire:
Enregistrer un commentaire