From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 21A6C383D8D3; Tue, 13 Dec 2022 13:18:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21A6C383D8D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670937508; bh=04vXZTRrLb7tu1mhDSlOlg23uwANXAfdj+0H+Wk9NkU=; h=From:To:Subject:Date:From; b=yewpdGHOxhrPKfLLdMf32PV0co+uF7aJr98WiRUVqS8sTVJfjgRFUXoiZZKxDfTw0 vFt8WEgZDtp1g/39/mpdQ6hHwtHJmIIKhcxCJhW1imd0wjgb0KwgXKahxlxMiofol3 PZ9IiCjalKUHBNjVH+Ti/8w+IiskrOpgBb3PU5BE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4650] gccrs: Add wrapper for make_unique X-Act-Checkin: gcc X-Git-Author: Philip Herron X-Git-Refname: refs/heads/master X-Git-Oldrev: 7999cf327de7b5bbea80046715eeb00c0755a08d X-Git-Newrev: b32b1b1576a6df965cb3fcbed3780b9f045286b2 Message-Id: <20221213131828.21A6C383D8D3@sourceware.org> Date: Tue, 13 Dec 2022 13:18:28 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b32b1b1576a6df965cb3fcbed3780b9f045286b2 commit r13-4650-gb32b1b1576a6df965cb3fcbed3780b9f045286b2 Author: Philip Herron Date: Tue Aug 23 16:22:22 2022 +0100 gccrs: Add wrapper for make_unique This is a wrapper for make_unique. We can likely get rid of this, as there are other implementations available, or simply keep using the unique_ptr constructor. gcc/rust/ * util/rust-make-unique.h: New. Diff: --- gcc/rust/util/rust-make-unique.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gcc/rust/util/rust-make-unique.h b/gcc/rust/util/rust-make-unique.h new file mode 100644 index 00000000000..7b79e625ff1 --- /dev/null +++ b/gcc/rust/util/rust-make-unique.h @@ -0,0 +1,35 @@ +// Copyright (C) 2020-2022 Free Software Foundation, Inc. + +// This file is part of GCC. + +// GCC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 3, or (at your option) any later +// version. + +// GCC is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. + +// You should have received a copy of the GNU General Public License +// along with GCC; see the file COPYING3. If not see +// . + +#ifndef RUST_MAKE_UNIQUE_H +#define RUST_MAKE_UNIQUE_H + +#include "rust-system.h" + +namespace Rust { + +template +std::unique_ptr +make_unique (Ts &&...params) +{ + return std::unique_ptr (new T (std::forward (params)...)); +} + +} // namespace Rust + +#endif // RUST_MAKE_UNIQUE_H