Skip to content

Commit a325b1b

Browse files
authored
[Hotfix] Copy assignment operator reference to local object error fix (#109)
1 parent 650deab commit a325b1b

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/internals/markov_internals.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ class MarkovImpl : public virtual Markov {
4040
}
4141

4242
MarkovImpl &operator=(const MarkovImpl &other) {
43-
MarkovImpl temp(GetLoggerName());
44-
45-
temp.SetTransitions(other.GetTransitions());
46-
temp.SetState(other.GetState());
47-
return temp;
43+
_logger_name = other.GetLoggerName();
44+
this->SetTransitions(other.GetTransitions());
45+
this->SetState(other.GetState());
46+
return *this;
4847
}
4948

5049
void SetState(const Eigen::VectorXd &state_vector) override {
@@ -74,7 +73,7 @@ class MarkovImpl : public virtual Markov {
7473
std::string GetLoggerName() const override { return _logger_name; }
7574

7675
private:
77-
const std::string _logger_name;
76+
std::string _logger_name;
7877
Eigen::VectorXd _state;
7978
std::vector<transition> _transitions = {};
8079
std::map<int, stamper> _stamper_functions;
@@ -121,4 +120,4 @@ class MarkovImpl : public virtual Markov {
121120
};
122121
} // namespace respond
123122

124-
#endif // RESPOND_MARKOVINTERNALS_HPP_
123+
#endif // RESPOND_MARKOVINTERNALS_HPP_

0 commit comments

Comments
 (0)