Skip to content
Snippets Groups Projects
Commit 4895a54c authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[CL] Avoid string copies. Use move

parent 16dac3cb
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ std::unique_ptr<Kinetics> createKineticReactants(
1);
std::fill(std::begin(*amount), std::end(*amount), initial_amount);
kinetic_reactants.emplace_back(name, initial_amount);
kinetic_reactants.emplace_back(std::move(name), initial_amount);
}
return std::make_unique<Kinetics>(kinetic_reactants);
......
......@@ -16,11 +16,10 @@ namespace ChemistryLib
{
namespace PhreeqcKernelData
{
KineticReactant::KineticReactant(std::string const& name,
double const initial_amount)
KineticReactant::KineticReactant(std::string name, double const initial_amount)
{
rate_name = name.c_str();
namecoef.add(name.c_str(), 1.0);
rate_name = std::move(name);
namecoef.add(rate_name.c_str(), 1.0);
m = initial_amount;
m0 = initial_amount;
}
......
......@@ -22,7 +22,7 @@ namespace PhreeqcKernelData
class KineticReactant final : private cxxKineticsComp
{
public:
KineticReactant(std::string const& name, double const initial_amount);
KineticReactant(std::string name, double const initial_amount);
cxxKineticsComp const* castToBaseClass() const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment