Problem in Bug 93240

Michael Stahl mstahl at redhat.com
Tue Sep 1 07:36:30 PDT 2015


On 01.09.2015 15:34, Shreyansh Gandhi wrote:
> I just came across
> this: http://stackoverflow.com/questions/24221955/creating-a-unique-ptr-from-a-pointer .
> Will it be safe to use this method to push_back into m_Selectors?

yes, if it was pushing to a boost::ptr_container before (and we can
assume that that works), then converting it to a unique_ptr only at the
place when it is pushed is doing exactly the same thing.

the only problem to watch out for, if you do it earlier and convert a
variable declaration to std::unique_ptr then std::move into the
container then the variable contains a null pointer now - but if you
convert the bare pointer only inside the push_back call then this
problem is avoided.




More information about the LibreOffice mailing list