From: Artem Zhmurov Date: Tue, 2 Feb 2021 05:06:55 +0000 (+0300) Subject: Use make_unique instead of reset when private implementations are constructed X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=28ebf5febf9f37102f371925f843dadb391791c4;p=alexxy%2Fgromacs.git Use make_unique instead of reset when private implementations are constructed Using std::unique_ptr instead of our own implementation in PImpl classes made compiler more aware of the code and clang-tidy started to complain about using reset function(...) for PImpl construction. --- diff --git a/src/gromacs/commandline/tests/cmdlinemodulemanagertest.cpp b/src/gromacs/commandline/tests/cmdlinemodulemanagertest.cpp index cb31e7c6cd..9d7684be2e 100644 --- a/src/gromacs/commandline/tests/cmdlinemodulemanagertest.cpp +++ b/src/gromacs/commandline/tests/cmdlinemodulemanagertest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2019,2020, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2019,2020,2021, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -143,7 +143,7 @@ CommandLineModuleManagerTestBase::~CommandLineModuleManagerTestBase() {} void CommandLineModuleManagerTestBase::initManager(const CommandLine& args, const char* realBinaryName) { GMX_RELEASE_ASSERT(impl_ == nullptr, "initManager() called more than once in test"); - impl_.reset(new Impl(args, realBinaryName)); + impl_ = std::make_unique(args, realBinaryName); } MockModule& CommandLineModuleManagerTestBase::addModule(const char* name, const char* description) diff --git a/src/gromacs/selection/symrec.cpp b/src/gromacs/selection/symrec.cpp index b435dda6b7..fb8b6bd7d7 100644 --- a/src/gromacs/selection/symrec.cpp +++ b/src/gromacs/selection/symrec.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 2009-2017, The GROMACS development team. - * Copyright (c) 2019, by the GROMACS development team, led by + * Copyright (c) 2019,2021, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -231,7 +231,7 @@ SelectionParserSymbolIterator::~SelectionParserSymbolIterator() {} SelectionParserSymbolIterator& SelectionParserSymbolIterator::operator=(const SelectionParserSymbolIterator& other) { - impl_.reset(new Impl(*other.impl_)); + impl_ = std::make_unique(*other.impl_); return *this; }