<html>
<head>
<base href="https://bugs.documentfoundation.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - Use o3tl::make_unique instead of new + std::move"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=94205">94205</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Use o3tl::make_unique instead of new + std::move
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sbergman@redhat.com
</td>
</tr>
<tr>
<th>CC</th>
<td>libreoffice@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>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:
<span class="quote">> 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);
> }
> }
> }</span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>