Use operator""s to replace some calls to std::string constructor
By the way, remove other unnecessary calls to that constructor.master
parent
83693e4427
commit
13dc0a1144
|
@ -404,7 +404,7 @@ DataTree::AddDiff(expr_t iArg1)
|
|||
expr_t
|
||||
DataTree::AddAdl(expr_t iArg1, const string &name, const vector<int> &lags)
|
||||
{
|
||||
return AddUnaryOp(UnaryOpcode::adl, iArg1, 0, 0, 0, string(name), lags);
|
||||
return AddUnaryOp(UnaryOpcode::adl, iArg1, 0, 0, 0, name, lags);
|
||||
}
|
||||
|
||||
expr_t
|
||||
|
|
|
@ -505,7 +505,7 @@ DynamicModel::writeDynamicPerBlockMFiles(const string &basename) const
|
|||
output << "function [residual, y, T, g1, varargout] = dynamic_" << blk+1 << "(y, x, params, steady_state, T, it_, stochastic_mode)" << endl;
|
||||
|
||||
output << " % ////////////////////////////////////////////////////////////////////////" << endl
|
||||
<< " % //" << string(" Block ").substr(static_cast<int>(log10(blk + 1))) << blk+1
|
||||
<< " % //" << " Block "s.substr(static_cast<int>(log10(blk + 1))) << blk+1
|
||||
<< " //" << endl
|
||||
<< " % // Simulation type "
|
||||
<< BlockSim(simulation_type) << " //" << endl
|
||||
|
|
|
@ -83,7 +83,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
|
|||
/* Rules for matching $line directives */
|
||||
<*>^@#line\ \" { line_caller = YYSTATE; BEGIN(LINE1); }
|
||||
<LINE1>[^\"]* {
|
||||
filename = string(yytext);
|
||||
filename = yytext;
|
||||
BEGIN(LINE2);
|
||||
}
|
||||
<LINE2>\" BEGIN(LINE3);
|
||||
|
@ -1127,7 +1127,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
|
|||
and move to the NATIVE context
|
||||
*/
|
||||
<INITIAL>\[([[:space:]]*[a-z_][a-z0-9_]*[[:space:]]*,{1}[[:space:]]*)*([[:space:]]*[a-z_][a-z0-9_]*[[:space:]]*){1}\] {
|
||||
string yytextcpy = string(yytext);
|
||||
string yytextcpy{yytext};
|
||||
yytextcpy.erase(remove(yytextcpy.begin(), yytextcpy.end(), '['), yytextcpy.end());
|
||||
yytextcpy.erase(remove(yytextcpy.begin(), yytextcpy.end(), ']'), yytextcpy.end());
|
||||
yytextcpy.erase(remove(yytextcpy.begin(), yytextcpy.end(), ' '), yytextcpy.end());
|
||||
|
@ -1166,7 +1166,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
|
|||
\"[^\"\n]*\" |
|
||||
\.{1,2} |
|
||||
\* |
|
||||
\/ { yymore(); eofbuff = string(yytext); }
|
||||
\/ { yymore(); eofbuff = yytext; }
|
||||
\.{3,}[[:space:]]*\n { driver.add_native_remove_charset(yytext, "\n"); }
|
||||
\n {
|
||||
if (strlen(yytext) > 1)
|
||||
|
|
|
@ -1890,7 +1890,7 @@ ModelTree::compileMEX(const string &basename, const string &funcname, const stri
|
|||
flags << " -static-libgcc -shared";
|
||||
// Put the MinGW environment shipped with Dynare in the path
|
||||
auto mingwpath = dynareroot / "mingw64" / "bin";
|
||||
string newpath = "PATH=" + mingwpath.string() + ';' + string{getenv("PATH")};
|
||||
string newpath = "PATH=" + mingwpath.string() + ';' + getenv("PATH");
|
||||
/* We can’t use setenv() since it is not available on MinGW. Note
|
||||
that putenv() seems to make a copy of the string on MinGW, contrary
|
||||
to what is done on GNU/Linux and macOS. */
|
||||
|
|
|
@ -3146,7 +3146,7 @@ ParsingDriver::add_model_var_or_external_function(const string &function_name, b
|
|||
if (!in_model_block && !parsing_epilogue && !parsing_pac_model)
|
||||
{
|
||||
if (stack_external_function_args.top().size() > 0)
|
||||
error(string("Symbol ") + function_name + string(" cannot take arguments."));
|
||||
error("Symbol " + function_name + " cannot take arguments.");
|
||||
else
|
||||
return add_expression_variable(function_name);
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ StaticModel::writeStaticPerBlockMFiles(const string &basename) const
|
|||
output << "function [residual, y, T, g1] = static_" << blk+1 << "(y, x, params, T)" << endl;
|
||||
|
||||
output << " % ////////////////////////////////////////////////////////////////////////" << endl
|
||||
<< " % //" << string(" Block ").substr(static_cast<int>(log10(blk + 1))) << blk+1
|
||||
<< " % //" << " Block "s.substr(static_cast<int>(log10(blk + 1))) << blk+1
|
||||
<< " //" << endl
|
||||
<< " % // Simulation type "
|
||||
<< BlockSim(simulation_type) << " //" << endl
|
||||
|
|
|
@ -486,7 +486,7 @@ SymbolTable::addExoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t e
|
|||
int
|
||||
SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t expr_arg) noexcept(false)
|
||||
{
|
||||
string varname{string{"AUX_EXPECT_"} + (information_set < 0 ? "LAG" : "LEAD") + "_"
|
||||
string varname{"AUX_EXPECT_"s + (information_set < 0 ? "LAG" : "LEAD") + "_"
|
||||
+ to_string(abs(information_set)) + "_" + to_string(index)};
|
||||
int symb_id;
|
||||
try
|
||||
|
|
Loading…
Reference in New Issue