diff --git a/alib2algo/src/automaton/properties/SynchronizingWordExistence.h b/alib2algo/src/automaton/properties/SynchronizingWordExistence.h index 1cf13953a9bb46fbee90d31509f13fa7ffb1a427..c7a92cba10915039a4251ed454b457ca45b3c5fc 100644 --- a/alib2algo/src/automaton/properties/SynchronizingWordExistence.h +++ b/alib2algo/src/automaton/properties/SynchronizingWordExistence.h @@ -66,7 +66,7 @@ bool SynchronizingWordExistence::exists ( const automaton::DFA < SymbolType, Sta std::queue < ext::pair < StateType, StateType > > q; ext::set < ext::pair < StateType, StateType > > visited; - for ( const ext::pair < StateType, StateType > state: cart.getStates ( ) ) { + for ( const ext::pair < StateType, StateType > & state: cart.getStates ( ) ) { if ( state.first != state.second ) continue; @@ -78,7 +78,7 @@ bool SynchronizingWordExistence::exists ( const automaton::DFA < SymbolType, Sta const ext::pair < StateType, StateType > cstate = std::move ( q.front ( ) ); q.pop ( ); - for ( const auto transition : cart.getTransitionsToState ( cstate ) ) { + for ( const auto & transition : cart.getTransitionsToState ( cstate ) ) { const auto & srcState = transition.first.first; if ( visited.count ( srcState ) == 0 ) { diff --git a/alib2algo/src/stringology/matching/GeneralizedLevenshteinSequenceMatchingAutomaton.h b/alib2algo/src/stringology/matching/GeneralizedLevenshteinSequenceMatchingAutomaton.h index c350f99f54c650962e0196705398b5550f9f1a3d..21b30fd8fd6eda2fd83dbf5e1d93877341062c81 100644 --- a/alib2algo/src/stringology/matching/GeneralizedLevenshteinSequenceMatchingAutomaton.h +++ b/alib2algo/src/stringology/matching/GeneralizedLevenshteinSequenceMatchingAutomaton.h @@ -72,7 +72,7 @@ template < class SymbolType > automaton::EpsilonNFA < SymbolType, ext::pair<unsigned int, unsigned int> > GeneralizedLevenshteinSequenceMatchingAutomaton::construct(const string::WildcardLinearString < SymbolType > & pattern, unsigned int allowed_errors) { auto result = stringology::matching::GeneralizedLevenshteinMatchingAutomaton::construct(pattern, allowed_errors); - SymbolType wildcard = pattern.getWildcardSymbol(); + const SymbolType& wildcard = pattern.getWildcardSymbol(); ext::set<SymbolType> alphabet_without_wildcard = pattern.getAlphabet(); alphabet_without_wildcard.erase(wildcard); diff --git a/alib2algo/src/stringology/matching/HammingSequenceMatchingAutomaton.h b/alib2algo/src/stringology/matching/HammingSequenceMatchingAutomaton.h index 398e76c49a3fb822a4f756e8fd53ce9f31f45f02..8fd3ec406c047bb20e83c2620f2ba07ec67a4ded 100644 --- a/alib2algo/src/stringology/matching/HammingSequenceMatchingAutomaton.h +++ b/alib2algo/src/stringology/matching/HammingSequenceMatchingAutomaton.h @@ -61,7 +61,7 @@ template < class SymbolType > automaton::NFA < SymbolType, ext::pair<unsigned int, unsigned int> > HammingSequenceMatchingAutomaton::construct(const string::WildcardLinearString < SymbolType > & pattern, unsigned int allowed_errors) { automaton::NFA < SymbolType, ext::pair<unsigned int, unsigned int > > result = stringology::matching::HammingMatchingAutomaton::construct(pattern, allowed_errors); - SymbolType wildcard = pattern.getWildcardSymbol(); + const SymbolType& wildcard = pattern.getWildcardSymbol(); ext::set<SymbolType> alphabet_without_wildcard = pattern.getAlphabet(); alphabet_without_wildcard.erase(wildcard); diff --git a/alib2data_experimental/src/indexes/stringology/SuffixTrieNodeTerminatingSymbol.cpp b/alib2data_experimental/src/indexes/stringology/SuffixTrieNodeTerminatingSymbol.cpp index 0ce9efe7b29226d18a14b806123de1a9e175cd48..eea84c0f76c2bdc3ef24c987a86d028d286f7e89 100644 --- a/alib2data_experimental/src/indexes/stringology/SuffixTrieNodeTerminatingSymbol.cpp +++ b/alib2data_experimental/src/indexes/stringology/SuffixTrieNodeTerminatingSymbol.cpp @@ -64,7 +64,7 @@ SuffixTrieNodeTerminatingSymbol & SuffixTrieNodeTerminatingSymbol::operator =( S } SuffixTrieNodeTerminatingSymbol::~SuffixTrieNodeTerminatingSymbol ( ) noexcept { - for ( auto element : m_children ) + for ( const auto& element : m_children ) delete element.second; m_children.clear ( ); diff --git a/alib2graph_algo/src/maximum_flow/FordFulkerson.cpp b/alib2graph_algo/src/maximum_flow/FordFulkerson.cpp index 7f4e75b6a293361ad702c8c7667943cab994b332..82155040fd796d68af9b77a9a6c80d122f830db0 100644 --- a/alib2graph_algo/src/maximum_flow/FordFulkerson.cpp +++ b/alib2graph_algo/src/maximum_flow/FordFulkerson.cpp @@ -161,15 +161,15 @@ static Flow fordfulkerson_impl_dir(const DirectedGraph &graph, updateFlow_dir(source, sink, ctx); // assign negative flow for the reversed pairs of nodes ? - for (auto u : ctx.flow) - for (auto v : u.second) + for (auto& u : ctx.flow) + for (auto& v : u.second) if (ctx.flow[u.first][v.first] != 0) ctx.flow[v.first][u.first] = -ctx.flow[u.first][v.first]; return ctx.flow; } -static Flow fordfulkerson_impl_undir(const UndirectedGraph &ugraph, node::Node source, node::Node sink) { +static Flow fordfulkerson_impl_undir(const UndirectedGraph &ugraph, const node::Node& source, const node::Node& sink) { DirectedGraph graph; for (auto &node: ugraph.getNodes()) {