Tidy: modernize-use-emplace
authorRoland Schulz <roland.schulz@intel.com>
Thu, 1 Sep 2016 21:15:42 +0000 (14:15 -0700)
committerDavid van der Spoel <davidvanderspoel@gmail.com>
Tue, 13 Sep 2016 18:52:32 +0000 (20:52 +0200)
run-clang-tidy.py -checks=modernize-use-emplace -header-filter=.* -fix -j80

http://llvm.org/releases/3.9.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-emplace.html

Change-Id: I57a17487837f7afacc915d1c3cbf13c802c2a83c

33 files changed:
src/gromacs/analysisdata/datamodulemanager.cpp
src/gromacs/analysisdata/datastorage.cpp
src/gromacs/analysisdata/modules/displacement.cpp
src/gromacs/analysisdata/modules/lifetime.cpp
src/gromacs/analysisdata/modules/plot.cpp
src/gromacs/analysisdata/tests/datatest.h
src/gromacs/commandline/cmdlinehelpmodule.cpp
src/gromacs/commandline/pargs.cpp
src/gromacs/commandline/tests/cmdlinehelpwriter.cpp
src/gromacs/commandline/tests/cmdlineprogramcontext.cpp
src/gromacs/fileio/tests/confio.cpp
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/math/tests/vectypes.cpp
src/gromacs/onlinehelp/helpformat.cpp
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/options/basicoptions.cpp
src/gromacs/options/options.cpp
src/gromacs/options/tests/optionsassigner.cpp
src/gromacs/selection/indexutil.cpp
src/gromacs/selection/selectioncollection.cpp
src/gromacs/selection/selectionoptionmanager.cpp
src/gromacs/selection/sm_keywords.cpp
src/gromacs/selection/tests/nbsearch.cpp
src/gromacs/selection/tests/poscalc.cpp
src/gromacs/trajectoryanalysis/analysismodule.cpp
src/gromacs/trajectoryanalysis/modules/select.cpp
src/gromacs/trajectoryanalysis/tests/surfacearea.cpp
src/gromacs/utility/datafilefinder.cpp
src/gromacs/utility/messagestringcollector.cpp
src/gromacs/utility/stringutil.cpp
src/testutils/cmdlinetest.cpp
src/testutils/testfileredirector.cpp
src/testutils/tests/interactivetest.cpp

index f9e4d8dbb3919b8d5be36f2d2b9fb3e7afeffa30..4eb0a4afafc7c23c32a9c77977a80d5e23ecbf06 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, 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.
@@ -302,7 +302,7 @@ AnalysisDataModuleManager::addModule(AbstractAnalysisData      *data,
     {
         impl_->bAllowMissing_ = false;
     }
-    impl_->modules_.push_back(Impl::ModuleInfo(module));
+    impl_->modules_.emplace_back(module);
 }
 
 void
index 41ffc5f35c233263b5069c704949ac2e5147b585..8eb79be9884a2b9a074db12022a18ee66b5586c0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, 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.
@@ -574,8 +574,7 @@ AnalysisDataStorageFrameData::AnalysisDataStorageFrameData(
         for (int i = 0; i < baseData().dataSetCount(); ++i)
         {
             int columnCount = baseData().columnCount(i);
-            pointSets_.push_back(
-                    AnalysisDataPointSetInfo(offset, columnCount, i, 0));
+            pointSets_.emplace_back(offset, columnCount, i, 0);
             offset += columnCount;
         }
     }
@@ -625,9 +624,8 @@ AnalysisDataStorageFrameData::addPointSet(int dataSetIndex, int firstColumn,
     }
     else if (storageImpl().needStorage())
     {
-        pointSets_.push_back(
-                AnalysisDataPointSetInfo(values_.size(), valueCount,
-                                         dataSetIndex, firstColumn));
+        pointSets_.emplace_back(values_.size(), valueCount,
+                                dataSetIndex, firstColumn);
         std::copy(begin, end, std::back_inserter(values_));
     }
 }
index 9b9b2f468d142476098947a1fc85a9f169308264..586357097dd9571340d7c76736bc03e94ce4df97 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2016, 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.
@@ -280,7 +280,7 @@ AnalysisDataDisplacementModule::frameFinished(const AnalysisDataFrameHeader & /*
             i += _impl->max_store;
         }
         _impl->currValues_.clear();
-        _impl->currValues_.push_back(AnalysisDataValue(step * _impl->dt));
+        _impl->currValues_.emplace_back(step * _impl->dt);
         int k = 1;
         for (int j = 0; j < _impl->nmax; j += _impl->ndim, ++k)
         {
@@ -292,7 +292,7 @@ AnalysisDataDisplacementModule::frameFinished(const AnalysisDataFrameHeader & /*
                     - _impl->oldval[i + j + d];
                 dist2 += displ * displ;
             }
-            _impl->currValues_.push_back(AnalysisDataValue(dist2));
+            _impl->currValues_.emplace_back(dist2);
         }
         moduleManager().notifyPointsAdd(AnalysisDataPointSetRef(header, _impl->currValues_));
     }
index 1c64c4d5172f489a8f3fa0e7132cc4f3ac9e0a3a..9278d288c81c9c947fc73c368942fa9f31b4d2af 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
@@ -142,8 +142,8 @@ AnalysisDataLifetimeModule::dataStarted(AbstractAnalysisData *data)
     impl_->lifetimeHistograms_.reserve(data->dataSetCount());
     for (int i = 0; i < data->dataSetCount(); ++i)
     {
-        impl_->currentLifetimes_.push_back(std::vector<int>(data->columnCount(i), 0));
-        impl_->lifetimeHistograms_.push_back(std::deque<int>());
+        impl_->currentLifetimes_.emplace_back(data->columnCount(i), 0);
+        impl_->lifetimeHistograms_.emplace_back();
     }
 }
 
index e24160f28feec6d8e0342e26ed5d8a136acab2cc..10e14a9b656faad6af88e8b5c3a6dcebdef58533 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, 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.
@@ -282,7 +282,7 @@ AbstractPlotModule::setLegend(int nsets, const char * const *setname)
 void
 AbstractPlotModule::appendLegend(const char *setname)
 {
-    impl_->legend_.push_back(setname);
+    impl_->legend_.emplace_back(setname);
 }
 
 
index 28abff7f0c7b841c03ee9af80bf23a45f22e8c4d..5ac37f1921a7137e081104d2b01af5841226b52e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016, 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.
@@ -115,11 +115,11 @@ class AnalysisDataTestInputPointSet
         }
 
         //! Appends a value to this point set.
-        void addValue(real y) { values_.push_back(Value(y)); }
+        void addValue(real y) { values_.emplace_back(y); }
         //! Appends a value with an error estimate to this point set.
         void addValueWithError(real y, real error)
         {
-            values_.push_back(Value(y, error));
+            values_.emplace_back(y, error);
         }
 
     private:
index a0b44a884d704c61a8406e79061171f6e7ed9c1a..0a2ceac2ec1e64441020e7ff76bb2caba326739e 100644 (file)
@@ -108,7 +108,7 @@ class RootHelpTopic : public AbstractCompositeHelpTopic
         {
             if (bExported)
             {
-                exportedTopics_.push_back(topic->name());
+                exportedTopics_.emplace_back(topic->name());
             }
             addSubTopic(std::move(topic));
         }
@@ -743,7 +743,7 @@ void HelpExportCompletion::exportModuleHelp(
         const std::string                 & /*tag*/,
         const std::string                 & /*displayName*/)
 {
-    modules_.push_back(module.name());
+    modules_.emplace_back(module.name());
     {
         CommandLineHelpContext context(&bashWriter_);
         // We use the display name to pass the name of the module to the
index edb4a056569ec8e2280c5c348051dd9166d48429..38052ac57c3deedc8b21a39d6991125b9c936fff 100644 (file)
@@ -344,7 +344,7 @@ void OptionsAdapter::filenmToOptions(Options *options, t_filenm *fnm)
         GMX_RELEASE_ASSERT(defType != efNR,
                            "File name option specifies an invalid extension");
     }
-    fileNameOptions_.push_back(FileNameData(fnm));
+    fileNameOptions_.emplace_back(fnm);
     FileNameData &data = fileNameOptions_.back();
     data.optionInfo = options->addOption(
                 FileNameOption(name).storeVector(&data.values)
@@ -361,7 +361,7 @@ void OptionsAdapter::pargsToOptions(Options *options, t_pargs *pa)
     const bool        bHidden = startsWith(pa->desc, "HIDDEN");
     const char *const name    = &pa->option[1];
     const char *const desc    = (bHidden ? &pa->desc[6] : pa->desc);
-    programArgs_.push_back(ProgramArgData(pa));
+    programArgs_.emplace_back(pa);
     ProgramArgData   &data = programArgs_.back();
     switch (pa->type)
     {
index b55b840f034002c3527ceaf8d16072098d073bf1..84f70e7891cdbb82565e95f341fb5c33ad32fd07 100644 (file)
@@ -181,7 +181,7 @@ TEST_F(CommandLineHelpWriterTest, HandlesDefaultValuesFromVariables)
                           .store(iavalue).valueCount(2));
 
     std::vector<std::string> svalues;
-    svalues.push_back("foo");
+    svalues.emplace_back("foo");
     options.addOption(StringOption("str").description("String option")
                           .storeVector(&svalues).multiValue());
 
@@ -248,8 +248,8 @@ TEST_F(CommandLineHelpWriterTest, HandlesLongOptions)
     options.addOption(DoubleOption("dvec").description("Double vector option")
                           .vector().store(dblvec));
     std::vector<std::string> values;
-    values.push_back("A very long string value that overflows even the description column");
-    values.push_back("Another very long string value that overflows even the description column");
+    values.emplace_back("A very long string value that overflows even the description column");
+    values.emplace_back("Another very long string value that overflows even the description column");
     options.addOption(StringOption("string")
                           .description("String option with very long values (may "
                                        "be less relevant with selections having "
index 376908bdb03ab9ea391d7bf987fe487980f9d628..4308ac80e7ba754176b845939787b4cfd0e38b14 100644 (file)
@@ -146,7 +146,7 @@ TEST_F(CommandLineProgramContextTest, FindsBinaryFromPath)
 TEST_F(CommandLineProgramContextTest, FindsBinaryFromCurrentDirectory)
 {
     env_->workingDirectory_ = Path::join(env_->getWorkingDirectory(), "bin");
-    env_->path_.push_back("");
+    env_->path_.emplace_back("");
     testBinaryPathSearch("test-exe");
 }
 
index 2863a9795d7cd1b5e4d893a94dbbb0aa4dbeda27..aff4ee969be653ba30b7488b583ea21fd72079de 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016, 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.
@@ -181,7 +181,7 @@ class StructureIORoundtripTest : public gmx::test::StringTestBase,
             refX_.reserve(atomCount);
             for (int i = 0; i < atomCount; ++i)
             {
-                refX_.push_back(gmx::RVec(i%4, i/4, (i/2)%3));
+                refX_.emplace_back(i%4, i/4, (i/2)%3);
             }
         }
 
index ff2f86e5705c5462c4bfe7e69395c8fb864db49e..1753d190f50ee0efbf940b8771bfbb940e8fad0f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
@@ -226,7 +226,7 @@ choose_ff_impl(const char *ffsel,
                 FILE *fp = gmx_ffopen(docFileName.c_str(), "r");
                 get_a_line(fp, buf, STRLEN);
                 gmx_ffclose(fp);
-                desc.push_back(buf);
+                desc.emplace_back(buf);
             }
             else
             {
index 94fe43128c4f99ea808b287fe5bf9b05d71da0d8..30505b0e5fc795a896b3ee61228ca8a42363eb05 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016, 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.
@@ -61,7 +61,7 @@ using gmx::RVec;
 TEST(RVecTest, CanBeStoredInVector)
 {
     std::vector<RVec> v;
-    v.push_back(RVec(1, 2, 3));
+    v.emplace_back(1, 2, 3);
     v.resize(2);
     EXPECT_EQ(1, v[0][XX]);
     EXPECT_EQ(2, v[0][YY]);
@@ -72,7 +72,7 @@ TEST(RVecTest, ConvertsImplicitlyFrom_rvec)
 {
     std::vector<RVec> v;
     rvec              x = { 1, 2, 3 };
-    v.push_back(x);
+    v.emplace_back(x);
     EXPECT_EQ(1, v[0][XX]);
     EXPECT_EQ(2, v[0][YY]);
     EXPECT_EQ(3, v[0][ZZ]);
@@ -81,7 +81,7 @@ TEST(RVecTest, ConvertsImplicitlyFrom_rvec)
 TEST(RVecTest, ConvertsImplicitlyTo_rvec)
 {
     std::vector<RVec> v;
-    v.push_back(RVec(1, 2, 3));
+    v.emplace_back(1, 2, 3);
     rvec              x;
     copy_rvec(v[0], x);
     EXPECT_EQ(1, x[XX]);
@@ -92,7 +92,7 @@ TEST(RVecTest, ConvertsImplicitlyTo_rvec)
 TEST(RVecTest, WorksAsMutable_rvec)
 {
     std::vector<RVec> v;
-    v.push_back(RVec(1, 2, 3));
+    v.emplace_back(1, 2, 3);
     rvec              x = {2, 3, 4};
     copy_rvec(x, v[0]);
     EXPECT_EQ(2, v[0][XX]);
@@ -103,8 +103,8 @@ TEST(RVecTest, WorksAsMutable_rvec)
 TEST(RVecTest, WorksAs_rvec_Array)
 {
     std::vector<RVec> v;
-    v.push_back(RVec(1, 2, 3));
-    v.push_back(RVec(2, 3, 4));
+    v.emplace_back(1, 2, 3);
+    v.emplace_back(2, 3, 4);
     const rvec *r = as_rvec_array(v.data());
     EXPECT_EQ(1, r[0][XX]);
     EXPECT_EQ(2, r[0][YY]);
index e5f7212393d66871c6804010df9e76efa066ef30..2648150a59626b8727a697d77bab56ee3f8419d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016, 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.
@@ -229,7 +229,7 @@ void TextTableFormatter::addColumn(const char *title, int width, bool bWrap)
     {
         impl_->bPrintHeader_ = true;
     }
-    impl_->columns_.push_back(Impl::ColumnData(title, width, bWrap));
+    impl_->columns_.emplace_back(title, width, bWrap);
 }
 
 void TextTableFormatter::setFirstColumnIndent(int indent)
@@ -341,7 +341,7 @@ std::string TextTableFormatter::formatRow()
                 {
                     if (overflow > columnWidth && column->bWrap_)
                     {
-                        columnLines.push_back(std::string());
+                        columnLines.emplace_back();
                         continue;
                     }
                     columnWidth -= overflow;
index 2e5a578cb4ed2c8ea7729d6dabc07d6ad15984f2..5e7e3a7d9cc8281a435c4a0564cf4a56f1e01eab 100644 (file)
@@ -409,7 +409,7 @@ void HelpLinks::addLink(const std::string &linkName,
         default:
             GMX_RELEASE_ASSERT(false, "Output format not implemented for links");
     }
-    impl_->links_.push_back(Impl::LinkItem(linkName, replacement));
+    impl_->links_.emplace_back(linkName, replacement);
 }
 
 /********************************************************************
@@ -508,7 +508,7 @@ class HelpWriterContext::Impl
         void addReplacement(const std::string &search,
                             const std::string &replace)
         {
-            replacements_.push_back(ReplaceItem(search, replace));
+            replacements_.emplace_back(search, replace);
         }
 
         //! Replaces links in a given string.
index 2ae8bc64dd5d6baa24e02fe608249bd796930a34..ceead73cf908daa0e90fff47b1eff62268903bc5 100644 (file)
@@ -464,7 +464,7 @@ StringOptionStorage::StringOptionStorage(const StringOption &settings)
             {
                 GMX_THROW(APIError("Enumeration value cannot be NULL"));
             }
-            allowed_.push_back(settings.enumValues_[i]);
+            allowed_.emplace_back(settings.enumValues_[i]);
         }
         if (settings.defaultEnumIndex_ >= 0)
         {
@@ -575,7 +575,7 @@ EnumOptionStorage::EnumOptionStorage(const AbstractOption &settings,
         {
             GMX_THROW(APIError("Enumeration value cannot be NULL"));
         }
-        allowed_.push_back(enumValues[i]);
+        allowed_.emplace_back(enumValues[i]);
     }
 
     GMX_ASSERT(defaultValue < count, "Default enumeration value is out of range");
index bbf4307f0f087b6b3e03652b6d250764f092b6d8..4fdf0efd342f9f882d380774272ac26307447e83 100644 (file)
@@ -200,7 +200,7 @@ void OptionSectionImpl::finish()
 
 IOptionsContainer &OptionSectionImpl::Group::addGroup()
 {
-    subgroups_.push_back(Group(parent_));
+    subgroups_.emplace_back(parent_);
     return subgroups_.back();
 }
 
index 2a3f5c53fd01ce14e9fe4ced0456d80d034f3bac..283fddc9609fa014b2f50c4b51d2c6e6759a864b 100644 (file)
@@ -856,8 +856,8 @@ TEST(OptionsAssignerStringTest, HandlesEnumDefaultValueFromVector)
 {
     gmx::Options             options;
     std::vector<std::string> value;
-    value.push_back("test");
-    value.push_back("value");
+    value.emplace_back("test");
+    value.emplace_back("value");
     using gmx::StringOption;
     ASSERT_NO_THROW(options.addOption(
                             StringOption("p").storeVector(&value).valueCount(2)
index beb5fd8481e4d7c74151f3c9e13fb815ecb7650d..ccfb25064bf117ebe86585f0b03ad538f7dfa1ca 100644 (file)
@@ -140,7 +140,7 @@ gmx_ana_indexgrps_init(gmx_ana_indexgrps_t **g, t_topology *top,
                 grp->index[j] = block->a[block->index[i]+j];
             }
             grp->nalloc_index = grp->isize;
-            (*g)->names.push_back(names[i]);
+            (*g)->names.emplace_back(names[i]);
         }
     }
     catch (...)
index 23fb458901e7c4db871a8d9ab67d5dde92a943c2..e2c1c071b768344e333e5388adf147429fb141d5 100644 (file)
@@ -406,7 +406,7 @@ early_termination:
     result.reserve(nr);
     for (i = sc->sel.begin() + oldCount; i != sc->sel.end(); ++i)
     {
-        result.push_back(Selection(i->get()));
+        result.emplace_back(i->get());
     }
     return result;
 }
index a31859b59baec6dc1aefddd4cfcf6951e2ffd403..54d43a4cc554a940e022809bba3ba4cf8a32bb9a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, 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.
@@ -246,7 +246,7 @@ void SelectionOptionManager::Impl::requestUnsetRequiredOptions()
         SelectionOptionStorage &storage = **i;
         if (storage.isRequired() && !storage.isSet())
         {
-            requests_.push_back(SelectionRequest(&storage));
+            requests_.emplace_back(&storage);
         }
     }
 }
@@ -285,7 +285,7 @@ void
 SelectionOptionManager::requestOptionDelayedParsing(
         SelectionOptionStorage *storage)
 {
-    impl_->requests_.push_back(Impl::SelectionRequest(storage));
+    impl_->requests_.emplace_back(storage);
 }
 
 bool
index 5dbfc1833bcba4bd1d3783e5dc658bbace292345..476a337ab8aabff291a211af4afb061b94f21982 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, 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.
@@ -625,7 +625,7 @@ init_kwstr(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, vo
     for (int i = 0; i < n; ++i)
     {
         const char *s = param[1].val.u.s[i];
-        d->matches.push_back(StringKeywordMatchItem(d->matchType, s));
+        d->matches.emplace_back(d->matchType, s);
     }
 }
 
index 9cc30ecb704428cff573d13c3934d071ed269631..240f282ead94cd6920d8c7cdea50ae3e6ce4894b 100644 (file)
@@ -132,7 +132,7 @@ class NeighborhoodSearchTestData
                 testPos_.reserve(testPositions_.size());
                 for (size_t i = 0; i < testPositions_.size(); ++i)
                 {
-                    testPos_.push_back(testPositions_[i].x);
+                    testPos_.emplace_back(testPositions_[i].x);
                 }
             }
             return gmx::AnalysisNeighborhoodPositions(testPos_);
@@ -146,7 +146,7 @@ class NeighborhoodSearchTestData
         {
             GMX_RELEASE_ASSERT(testPos_.empty(),
                                "Cannot add positions after testPositions() call");
-            testPositions_.push_back(TestPosition(x));
+            testPositions_.emplace_back(x);
         }
         gmx::RVec generateRandomPosition();
         std::vector<int> generateIndex(int count, gmx_uint64_t seed) const;
index c9ed4c7f9418fbdc09019c7a5111649bb4789cb7..e51cbe41aa2f7de5a5c48fa1ad8051246edfe3e2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
@@ -201,7 +201,7 @@ PositionCalculationTest::initPositions(gmx_ana_poscalc_t *pc, const char *name)
     posList_.reserve(posList_.size() + 1);
     PositionPointer p(new gmx_ana_pos_t());
     gmx_ana_pos_t  *result = p.get();
-    posList_.push_back(PositionTest(std::move(p), pc, name));
+    posList_.emplace_back(std::move(p), pc, name);
     gmx_ana_poscalc_init_pos(pc, result);
     return result;
 }
index fab17441dd41c7107b98fd58a0a5314703d86130..11b2fc2b14b3be6d2d58671a4dfb5a88848c6156 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, 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.
@@ -350,7 +350,7 @@ void TrajectoryAnalysisModule::registerBasicDataset(AbstractAnalysisData *data,
     GMX_RELEASE_ASSERT(impl_->datasets_.find(name) == impl_->datasets_.end(),
                        "Duplicate data set name registered");
     impl_->datasets_[name] = data;
-    impl_->datasetNames_.push_back(name);
+    impl_->datasetNames_.emplace_back(name);
 }
 
 
index 44b3db90f8d63a8d4706f4ff5036ec60e426b1e0..8a9f349193f408711bbd17bac9f300f5cfd25d32 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, 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.
@@ -168,7 +168,7 @@ void IndexFileWriterModule::addGroup(const std::string &name, bool bDynamic)
 {
     std::string newName(name);
     std::replace(newName.begin(), newName.end(), ' ', '_');
-    groups_.push_back(GroupInfo(newName, bDynamic));
+    groups_.emplace_back(newName, bDynamic);
 }
 
 
index 30dc1a344eedc16ce8d74c6b7caed2c846827a52..f7607f6264913e1a20bf65873fb26fd2de0a8d9a 100644 (file)
@@ -88,7 +88,7 @@ class SurfaceAreaTest : public ::testing::Test
             {
                 index_.push_back(x_.size());
             }
-            x_.push_back(gmx::RVec(x, y, z));
+            x_.emplace_back(x, y, z);
             radius_.push_back(radius);
         }
 
index af7020e9395e129e74add506c511d3ba9a339108..598997ed33a020298abae4df8aba2853daa137a1 100644 (file)
@@ -227,7 +227,7 @@ DataFileFinder::enumerateFiles(const DataFileOptions &options) const
                         ".", options.filename_, false);
         for (i = files.begin(); i != files.end(); ++i)
         {
-            result.push_back(DataFileInfo(".", *i, false));
+            result.emplace_back(".", *i, false);
         }
     }
     if (impl_ != nullptr)
@@ -240,7 +240,7 @@ DataFileFinder::enumerateFiles(const DataFileOptions &options) const
                             j->c_str(), options.filename_, false);
             for (i = files.begin(); i != files.end(); ++i)
             {
-                result.push_back(DataFileInfo(*j, *i, false));
+                result.emplace_back(*j, *i, false);
             }
         }
     }
@@ -252,7 +252,7 @@ DataFileFinder::enumerateFiles(const DataFileOptions &options) const
                         defaultPath.c_str(), options.filename_, false);
         for (i = files.begin(); i != files.end(); ++i)
         {
-            result.push_back(DataFileInfo(defaultPath, *i, true));
+            result.emplace_back(defaultPath, *i, true);
         }
     }
     if (result.empty() && options.bThrow_)
index 937bb541cb99510b665d0426b72a066b5ff73321..97d2853ec499829435a13cff94ad949b2def908d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2014,2016, 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.
@@ -71,7 +71,7 @@ MessageStringCollector::~MessageStringCollector()
 
 void MessageStringCollector::startContext(const char *name)
 {
-    impl_->contexts_.push_back(name);
+    impl_->contexts_.emplace_back(name);
 }
 
 void MessageStringCollector::append(const std::string &message)
index a6286559aac4ca8dca04382fca1198b4afb2823a..1a1b1c1e224e4ef6e64da0e16aac0e13693e32dd 100644 (file)
@@ -191,7 +191,7 @@ std::vector<std::string> splitString(const std::string &str)
         }
         if (startPos != end)
         {
-            result.push_back(std::string(startPos, currPos));
+            result.emplace_back(startPos, currPos);
         }
     }
     return result;
index d70187ea534dda0b7a83c88fb1c3f11e13b5fdbe..eb05df8a9bf31eb6c8b91fc61e229ffb77b624a9 100644 (file)
@@ -358,8 +358,7 @@ void CommandLineTestHelper::setOutputFile(
     }
     std::string fullFilename = impl_->fileManager_.getTemporaryFilePath(suffix);
     args->addOption(option, fullFilename);
-    impl_->outputFiles_.push_back(
-            Impl::OutputFileInfo(option, fullFilename, matcher.createMatcher()));
+    impl_->outputFiles_.emplace_back(option, fullFilename, matcher.createMatcher());
 }
 
 void CommandLineTestHelper::checkOutputFiles(TestReferenceChecker checker) const
index 5844d99966b51f804775c3ae0d5a94ff430a5e56..ef233ddf90ae5c060ad46e02591439468d0ca1b7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016, 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.
@@ -119,7 +119,7 @@ TextOutputStream &TestFileOutputRedirector::standardOutput()
     if (!impl_->stdoutStream_)
     {
         impl_->stdoutStream_.reset(new StringOutputStream);
-        impl_->fileList_.push_back(Impl::FileListEntry("<stdout>", impl_->stdoutStream_));
+        impl_->fileList_.emplace_back("<stdout>", impl_->stdoutStream_);
     }
     return *impl_->stdoutStream_;
 }
@@ -128,7 +128,7 @@ TextOutputStreamPointer
 TestFileOutputRedirector::openTextOutputFile(const char *filename)
 {
     Impl::StringStreamPointer stream(new StringOutputStream);
-    impl_->fileList_.push_back(Impl::FileListEntry(filename, stream));
+    impl_->fileList_.emplace_back(filename, stream);
     return stream;
 }
 
index 974688cdbee435f1ea167e49d97570c430c86aed..eb1ac9914feea3f08121287dc16c47c806bd7089 100644 (file)
@@ -65,7 +65,7 @@ class InteractiveSession
 
         void addOutput(const char *output)
         {
-            events_.push_back(Event(WriteOutput, output));
+            events_.emplace_back(WriteOutput, output);
         }
         void addInputLine(const char *inputLine)
         {
@@ -73,7 +73,7 @@ class InteractiveSession
         }
         void addReadInput()
         {
-            events_.push_back(Event(ReadInput, ""));
+            events_.emplace_back(ReadInput, "");
         }
         void addInput(const char *inputLine)
         {
@@ -84,7 +84,7 @@ class InteractiveSession
         {
             addInputLine(inputLine);
             helper_.setLastNewline(false);
-            events_.push_back(Event(ReadInputNoNewline, ""));
+            events_.emplace_back(ReadInputNoNewline, "");
         }
 
         void run()