[Bug 94205] New: Use o3tl::make_unique instead of new + std::move
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Sep 14 01:03:13 PDT 2015
https://bugs.documentfoundation.org/show_bug.cgi?id=94205
Bug ID: 94205
Summary: Use o3tl::make_unique instead of new + std::move
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: enhancement
Priority: medium
Component: LibreOffice
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: sbergman at redhat.com
CC: libreoffice at lists.freedesktop.org
Some places across the code base that currently instantiate a local
std::unique_ptr and then std::move it into a function call can make use of
std::make_unique instead (which is only C++14, so we have o3tl::make_unique for
now, #include <o3tl/make_unique.hxx>).
For example:
> diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
> index a9b8c69..bab81f6 100644
> --- a/basctl/source/basicide/moduldl2.cxx
> +++ b/basctl/source/basicide/moduldl2.cxx
> @@ -58,7 +58,6 @@
> #include <cppuhelper/implbase.hxx>
>
> #include <cassert>
> -#include <memory>
>
> namespace basctl
> {
> @@ -254,9 +253,9 @@ void CheckBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rTxt,
> for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol )
> {
> SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol ));
> - std::unique_ptr<LibLBoxString> pStr(
> - new LibLBoxString( pEntry, 0, rCol.GetText()));
> - pEntry->ReplaceItem(std::move(pStr), nCol);
> + pEntry->ReplaceItem(
> + o3tl::make_unique<LibLBoxString>(pEntry, 0, rCol.GetText()),
> + nCol);
> }
> }
> }
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150914/1e09acf3/attachment.html>
More information about the LibreOffice
mailing list