Skip to content

Commit 26a683a

Browse files
committed
refactor: pass onChange by const ref
1 parent 8dfb6b4 commit 26a683a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

export/include/fmu4cpp/fmu_variable.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace fmu4cpp {
103103
public:
104104
Variable(
105105
const std::string &name,
106-
unsigned int vr, size_t index, T *ptr, const std::function<void(T)>& onChange)
106+
unsigned int vr, size_t index, T *ptr, const std::function<void(T)> &onChange)
107107
: VariableBase(name, vr, index), access_(std::make_unique<PtrAccess<T>>(ptr, onChange)) {}
108108

109109
Variable(
@@ -170,7 +170,7 @@ namespace fmu4cpp {
170170
public:
171171
IntVariable(
172172
const std::string &name,
173-
unsigned int vr, size_t index, int *ptr, std::function<void(int)> onChange)
173+
unsigned int vr, size_t index, int *ptr, const std::function<void(int)> &onChange)
174174
: Variable(name, vr, index, ptr, onChange) {}
175175

176176
IntVariable(
@@ -208,7 +208,7 @@ namespace fmu4cpp {
208208
public:
209209
RealVariable(
210210
const std::string &name,
211-
unsigned int vr, size_t index, double *ptr, const std::function<void(double)>& onChange)
211+
unsigned int vr, size_t index, double *ptr, const std::function<void(double)> &onChange)
212212
: Variable(name, vr, index, ptr, onChange) {
213213

214214
variability_ = variability_t::CONTINUOUS;
@@ -252,7 +252,7 @@ namespace fmu4cpp {
252252
public:
253253
BoolVariable(
254254
const std::string &name,
255-
unsigned int vr, size_t index, bool *ptr, const std::function<void(bool)>& onChange)
255+
unsigned int vr, size_t index, bool *ptr, const std::function<void(bool)> &onChange)
256256
: Variable(name, vr, index, ptr, onChange) {}
257257

258258
BoolVariable(
@@ -268,7 +268,7 @@ namespace fmu4cpp {
268268
public:
269269
StringVariable(
270270
const std::string &name,
271-
unsigned int vr, size_t index, std::string *ptr, const std::function<void(std::string)>& onChange)
271+
unsigned int vr, size_t index, std::string *ptr, const std::function<void(std::string)> &onChange)
272272
: Variable(name, vr, index, ptr, onChange) {}
273273

274274
StringVariable(

0 commit comments

Comments
 (0)