Port some constructors to pass-by-value using C++11 move semantics

Performed using modernize-pass-by-value from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html
parent 20243305
......@@ -9,6 +9,7 @@
#include <dynlapack.h>
#include <limits>
#include <utility>
template <>
int DRFixPoint<KOrder::fold>::max_iter = 10000;
......@@ -439,9 +440,9 @@ RTSimResultsStats::writeMat(mat_t *fd, const char *lname)
}
IRFResults::IRFResults(const DynamicModel &mod, const DecisionRule &dr,
const SimResults &control, const vector<int> &ili,
const SimResults &control, vector<int> ili,
Journal &journal)
: model(mod), irf_list_ind(ili)
: model(mod), irf_list_ind(std::move(ili))
{
int num_per = control.getNumPer();
JournalRecordPair pa(journal);
......
......@@ -901,7 +901,7 @@ class IRFResults
vector<int> irf_list_ind;
public:
IRFResults(const DynamicModel &mod, const DecisionRule &dr,
const SimResults &control, const vector<int> &ili,
const SimResults &control, vector<int> ili,
Journal &journal);
~IRFResults();
void writeMat(mat_t *fd, const char *prefix) const;
......
......@@ -3,6 +3,8 @@
#ifndef OGP_FORMULA_PARSER_H
#define OGP_FORMULA_PARSER_H
#include <utility>
#include "tree.hh"
namespace ogp
......@@ -336,13 +338,13 @@ namespace ogp
vector<int> terms;
public:
/** Construct from FormulaParser and given list of terms. */
FormulaCustomEvaluator(const FormulaParser &fp, const vector<int> &ts)
: etree(fp.otree), terms(ts)
FormulaCustomEvaluator(const FormulaParser &fp, vector<int> ts)
: etree(fp.otree), terms(std::move(ts))
{
}
/** Construct from OperationTree and given list of terms. */
FormulaCustomEvaluator(const OperationTree &ot, const vector<int> &ts)
: etree(ot), terms(ts)
FormulaCustomEvaluator(const OperationTree &ot, vector<int> ts)
: etree(ot), terms(std::move(ts))
{
}
/** Evaluate the terms using the given AtomValues and load the
......
......@@ -6,6 +6,7 @@
#include "dynare_exception.hh"
#include <cmath>
#include <utility>
using namespace ogdyn;
......@@ -30,8 +31,8 @@ IntegerArray3::operator=(const IntegerArray3 &ia3)
}
PlannerBuilder::PlannerBuilder(DynareModel &m, const Tvarset &yyset,
const Teqset &ffset)
: yset(), fset(ffset), model(m),
Teqset ffset)
: yset(), fset(std::move(ffset)), model(m),
tb(model.t_plobjective), tbeta(model.t_pldiscount),
maxlead(model.atoms.get_maxlead()),
minlag(model.atoms.get_minlag()),
......
......@@ -232,7 +232,7 @@ namespace ogdyn
* predetermined process which cannot be influenced by the
* social planner. */
PlannerBuilder(ogdyn::DynareModel &m, const Tvarset &yyset,
const Teqset &ffset);
Teqset ffset);
/** Construct a copy of the builder with provided model, which
* is supposed to be the copy of the model in the builder. */
PlannerBuilder(const PlannerBuilder &pb, ogdyn::DynareModel &m);
......
......@@ -9,6 +9,7 @@
#include "SylvMemory.hh"
#include <string>
#include <utility>
using namespace std;
......@@ -16,7 +17,7 @@ class MMException : public MallocAllocator
{
string message;
public:
MMException(string mes) : message(mes)
MMException(string mes) : message(std::move(mes))
{
}
MMException(const char *mes) : message(mes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment