2015-11-09 14:28 GMT-03:00 Christian Beer <[email protected]>:
> this is another one of the High impact defects that has a simple fix and
> where I'm not sure if this is really the intended behavior. All the code
> that uses work_items points to this solution which seems strange because
> it creates a new DB_WORK_ITEM object, copies it into the vector and then
> destroys the original object. The alternative would be to have a vector
> of pointers to DB_WORK_ITEM objects but for this, one has to change the
> code in scan_work_array() too.

That is how vectors have to be used in C++98, there is no other way.
Either you copy an object into it and destroy the original if you
don't need it for something else, or you make a vector of pointers.

In C++11 you have more alternatives. You can std::move an object into
the vector, or you can use vector.emplace_back to construct the object
in-place inside the vector.

-- 
Nicolás
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to