remove unwanted copies

parent aadc2dea
......@@ -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 ) {
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 ( );
......
......@@ -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()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment