From 9fef919c36077c0e68be91025a1878722a2bdaf0 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <jan.travnicek@.fit.cvut.cz> Date: Tue, 28 May 2019 10:56:46 +0200 Subject: [PATCH] fix unintended pass by value --- alib2data/src/automaton/TA/DFTA.h | 4 ++-- alib2data/src/automaton/TA/ExtendedNFTA.h | 4 ++-- alib2data/src/automaton/TA/NFTA.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/alib2data/src/automaton/TA/DFTA.h b/alib2data/src/automaton/TA/DFTA.h index aa04f7f6fd..0cd75bfb18 100644 --- a/alib2data/src/automaton/TA/DFTA.h +++ b/alib2data/src/automaton/TA/DFTA.h @@ -284,7 +284,7 @@ public: * * \returns true if the transition was indeed removed */ - bool removeTransition ( const common::ranked_symbol < SymbolType, RankType > symbol, const ext::vector < StateType > & states, const StateType & next ); + bool removeTransition ( const common::ranked_symbol < SymbolType, RankType > & symbol, const ext::vector < StateType > & states, const StateType & next ); /** * Get the transition function of the automaton in its natural form. @@ -430,7 +430,7 @@ bool DFTA < SymbolType, RankType, StateType >::addTransition ( common::ranked_sy } template<class SymbolType, class RankType, class StateType > -bool DFTA < SymbolType, RankType, StateType >::removeTransition(const common::ranked_symbol < SymbolType, RankType > symbol, const ext::vector<StateType> & states, const StateType & next) { +bool DFTA < SymbolType, RankType, StateType >::removeTransition(const common::ranked_symbol < SymbolType, RankType > & symbol, const ext::vector<StateType> & states, const StateType & next) { ext::pair<common::ranked_symbol < SymbolType, RankType >, ext::vector<StateType> > key = ext::make_pair(symbol, states); if ( transitions.find ( key ) == transitions.end ( ) ) diff --git a/alib2data/src/automaton/TA/ExtendedNFTA.h b/alib2data/src/automaton/TA/ExtendedNFTA.h index 971ade8d2e..3bda34402b 100644 --- a/alib2data/src/automaton/TA/ExtendedNFTA.h +++ b/alib2data/src/automaton/TA/ExtendedNFTA.h @@ -309,7 +309,7 @@ public: * * \returns true if the transition was indeed removed */ - bool removeTransition ( const rte::FormalRTEStructure < ext::variant < SymbolType, StateType >, RankType > rte, const ext::vector < StateType > & prevStates, const StateType& next ); + bool removeTransition ( const rte::FormalRTEStructure < ext::variant < SymbolType, StateType >, RankType > & rte, const ext::vector < StateType > & prevStates, const StateType& next ); /** * Get the transition function of the automaton in its natural form. @@ -475,7 +475,7 @@ void ExtendedNFTA < SymbolType, RankType, StateType >::addTransitions ( rte::For } template < class SymbolType, class RankType, class StateType > -bool ExtendedNFTA < SymbolType, RankType, StateType >::removeTransition ( const rte::FormalRTEStructure < ext::variant < SymbolType, StateType >, RankType > rte, const ext::vector < StateType > & prevStates, const StateType& next ) { +bool ExtendedNFTA < SymbolType, RankType, StateType >::removeTransition ( const rte::FormalRTEStructure < ext::variant < SymbolType, StateType >, RankType > & rte, const ext::vector < StateType > & prevStates, const StateType& next ) { ext::pair < rte::FormalRTEStructure < ext::variant < SymbolType, StateType >, RankType >, ext::vector < StateType > > key = ext::make_pair ( rte, prevStates ); return transitions [ key ].erase ( next ); } diff --git a/alib2data/src/automaton/TA/NFTA.h b/alib2data/src/automaton/TA/NFTA.h index b167b29da1..7a7963d3ac 100644 --- a/alib2data/src/automaton/TA/NFTA.h +++ b/alib2data/src/automaton/TA/NFTA.h @@ -289,7 +289,7 @@ public: * * \returns true if the transition was indeed removed */ - bool removeTransition ( const common::ranked_symbol < SymbolType, RankType > symbol, const ext::vector < StateType > & states, const StateType & next ); + bool removeTransition ( const common::ranked_symbol < SymbolType, RankType > & symbol, const ext::vector < StateType > & states, const StateType & next ); /** * Get the transition function of the automaton in its natural form. @@ -448,7 +448,7 @@ bool NFTA < SymbolType, RankType, StateType >::addTransition ( common::ranked_sy } template < class SymbolType, class RankType, class StateType > -bool NFTA < SymbolType, RankType, StateType >::removeTransition(const common::ranked_symbol < SymbolType, RankType > symbol, const ext::vector<StateType> & states, const StateType & next) { +bool NFTA < SymbolType, RankType, StateType >::removeTransition(const common::ranked_symbol < SymbolType, RankType > & symbol, const ext::vector<StateType> & states, const StateType & next) { auto upper_bound = transitions.upper_bound ( ext::tie ( symbol, states ) ); auto lower_bound = transitions.lower_bound ( ext::tie ( symbol, states ) ); auto iter = std::find_if ( lower_bound, upper_bound, [ & ] ( const auto & transition ) { return transition.second == next; } ); -- GitLab