@@ -266,7 +266,7 @@ class DepthFirstSearch {
266
266
};
267
267
268
268
// access state
269
- StateRef getState () { return this ->state ; }
269
+ StateRef getState () const { return this ->state ; }
270
270
271
271
SetOfEdgeRefs::CIter getIter () { return this ->iter ; }
272
272
@@ -471,7 +471,7 @@ class DetectCycle : public DepthFirstSearch {
471
471
void onSimpleCycle (DfsStack &stack) override {
472
472
if (!this ->hasCycle ) {
473
473
if (this ->cycle != nullptr ) {
474
- for (auto si : stack) {
474
+ for (const auto & si : stack) {
475
475
this ->cycle ->push_back (si.getState ());
476
476
}
477
477
}
@@ -801,8 +801,8 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
801
801
};
802
802
803
803
void setEdgeLabel (const EdgeRef<StateLabelType, EdgeLabelType> &e, const EdgeLabelType &l) {
804
- auto ee = dynamic_cast <Edge<StateLabelType, EdgeLabelType>*>(
805
- (* this -> edges . find (e-> getId ())). second .get ());
804
+ const auto & p = (* this -> edges . find (e-> getId ())). second ;
805
+ auto ee = dynamic_cast <Edge<StateLabelType, EdgeLabelType>*>(p .get ());
806
806
ee->setLabel (l);
807
807
}
808
808
@@ -856,7 +856,7 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
856
856
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>> determinizeEdgeLabels () {
857
857
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>> result =
858
858
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>>(
859
- dynamic_cast <FiniteStateMachine<StateLabelType, EdgeLabelType>*>(this ->newInstance ().release ()));
859
+ dynamic_cast <FiniteStateMachine<StateLabelType, EdgeLabelType> *>(this ->newInstance ().release ()));
860
860
861
861
// maintain map of sets of states to the corresponding new states.
862
862
std::map<const Abstract::SetOfStateRefs, const State<StateLabelType, EdgeLabelType> *>
@@ -1058,9 +1058,10 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
1058
1058
eqClasses = std::move (newEqClasses);
1059
1059
} while (changed);
1060
1060
1061
+ auto x = this ->newInstance ().release ();
1062
+ auto y = static_cast <FiniteStateMachine<StateLabelType, EdgeLabelType>*>(x);
1061
1063
std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>> result =
1062
- std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>>(
1063
- dynamic_cast <FiniteStateMachine<StateLabelType, EdgeLabelType>*>(this ->newInstance ().release ()));
1064
+ std::unique_ptr<FiniteStateMachine<StateLabelType, EdgeLabelType>>(y);
1064
1065
1065
1066
// make a state for every equivalence class
1066
1067
std::map<Abstract::SetOfStateRefs *, StateRef<StateLabelType, EdgeLabelType>> newStateMap;
0 commit comments