[PATCH] 2/2 List cleanup in SD

Lubos Lunak l.lunak at suse.cz
Mon Apr 16 09:49:53 PDT 2012


On Sunday 15 of April 2012, Rafael Dominguez wrote:
> Here are the patching fixing the issues you pointed me out.

 Yes, good, pushed, thanks again.

 One thing I didn't mention explicitly when talking about the named return 
value optimization was that it is done only if the named return variable is 
actually needed. If all return statements are expressions invoking 
constructors, then the named variable is not needed and the (non-named) 
return value optimization takes care of avoiding copies as well. So 
SdInsertPagesObjsDlg::GetList() can simply do

if( ... )
    return std::vector<rtl::OUString>();
return aLbTree.GetSelectEntryList( nType );

which will avoid the copy when calling the other function as well, and the 
function is not called at all when not needed. I tweaked that before 
committing, now it's perfect :).

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list