Use make_unique instead of reset when private implementations are constructed
authorArtem Zhmurov <zhmurov@gmail.com>
Tue, 2 Feb 2021 05:06:55 +0000 (08:06 +0300)
committerAndrey Alekseenko <al42and@gmail.com>
Tue, 2 Feb 2021 10:14:28 +0000 (10:14 +0000)
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.

src/gromacs/commandline/tests/cmdlinemodulemanagertest.cpp
src/gromacs/selection/symrec.cpp

index cb31e7c6cd8899b5cedf0835cce5f2387c6965ff..9d7684be2e616bda64bab5ba7dabbfa4f40ca91b 100644 (file)
@@ -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<Impl>(args, realBinaryName);
 }
 
 MockModule& CommandLineModuleManagerTestBase::addModule(const char* name, const char* description)
index b435dda6b7ea1178c125c2dfeaaaf44b244ca8af..fb8b6bd7d79df0235a098ee867c914f6ec9b801c 100644 (file)
@@ -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<Impl>(*other.impl_);
     return *this;
 }