/*
* 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.
{
impl_->bAllowMissing_ = false;
}
- impl_->modules_.push_back(Impl::ModuleInfo(module));
+ impl_->modules_.emplace_back(module);
}
void
/*
* 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.
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;
}
}
}
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_));
}
}
/*
* 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.
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)
{
- _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_));
}
/*
* 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.
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();
}
}
/*
* 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.
void
AbstractPlotModule::appendLegend(const char *setname)
{
- impl_->legend_.push_back(setname);
+ impl_->legend_.emplace_back(setname);
}
/*
* 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.
}
//! 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:
{
if (bExported)
{
- exportedTopics_.push_back(topic->name());
+ exportedTopics_.emplace_back(topic->name());
}
addSubTopic(std::move(topic));
}
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
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)
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)
{
.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());
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 "
TEST_F(CommandLineProgramContextTest, FindsBinaryFromCurrentDirectory)
{
env_->workingDirectory_ = Path::join(env_->getWorkingDirectory(), "bin");
- env_->path_.push_back("");
+ env_->path_.emplace_back("");
testBinaryPathSearch("test-exe");
}
/*
* 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.
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);
}
}
*
* 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.
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
{
/*
* 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.
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]);
{
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]);
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]);
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]);
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]);
/*
* 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.
{
impl_->bPrintHeader_ = true;
}
- impl_->columns_.push_back(Impl::ColumnData(title, width, bWrap));
+ impl_->columns_.emplace_back(title, width, bWrap);
}
void TextTableFormatter::setFirstColumnIndent(int indent)
{
if (overflow > columnWidth && column->bWrap_)
{
- columnLines.push_back(std::string());
+ columnLines.emplace_back();
continue;
}
columnWidth -= overflow;
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);
}
/********************************************************************
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.
{
GMX_THROW(APIError("Enumeration value cannot be NULL"));
}
- allowed_.push_back(settings.enumValues_[i]);
+ allowed_.emplace_back(settings.enumValues_[i]);
}
if (settings.defaultEnumIndex_ >= 0)
{
{
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");
IOptionsContainer &OptionSectionImpl::Group::addGroup()
{
- subgroups_.push_back(Group(parent_));
+ subgroups_.emplace_back(parent_);
return subgroups_.back();
}
{
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)
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 (...)
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;
}
/*
* 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.
SelectionOptionStorage &storage = **i;
if (storage.isRequired() && !storage.isSet())
{
- requests_.push_back(SelectionRequest(&storage));
+ requests_.emplace_back(&storage);
}
}
}
SelectionOptionManager::requestOptionDelayedParsing(
SelectionOptionStorage *storage)
{
- impl_->requests_.push_back(Impl::SelectionRequest(storage));
+ impl_->requests_.emplace_back(storage);
}
bool
/*
* 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.
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);
}
}
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_);
{
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;
/*
* 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.
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;
}
/*
* 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.
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);
}
/*
* 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.
{
std::string newName(name);
std::replace(newName.begin(), newName.end(), ' ', '_');
- groups_.push_back(GroupInfo(newName, bDynamic));
+ groups_.emplace_back(newName, bDynamic);
}
{
index_.push_back(x_.size());
}
- x_.push_back(gmx::RVec(x, y, z));
+ x_.emplace_back(x, y, z);
radius_.push_back(radius);
}
".", 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)
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);
}
}
}
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_)
/*
* 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.
void MessageStringCollector::startContext(const char *name)
{
- impl_->contexts_.push_back(name);
+ impl_->contexts_.emplace_back(name);
}
void MessageStringCollector::append(const std::string &message)
}
if (startPos != end)
{
- result.push_back(std::string(startPos, currPos));
+ result.emplace_back(startPos, currPos);
}
}
return result;
}
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
/*
* 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.
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_;
}
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;
}
void addOutput(const char *output)
{
- events_.push_back(Event(WriteOutput, output));
+ events_.emplace_back(WriteOutput, output);
}
void addInputLine(const char *inputLine)
{
}
void addReadInput()
{
- events_.push_back(Event(ReadInput, ""));
+ events_.emplace_back(ReadInput, "");
}
void addInput(const char *inputLine)
{
{
addInputLine(inputLine);
helper_.setLastNewline(false);
- events_.push_back(Event(ReadInputNoNewline, ""));
+ events_.emplace_back(ReadInputNoNewline, "");
}
void run()