Skip to content
Snippets Groups Projects
Unverified Commit b078259d authored by Tomáš Pecka's avatar Tomáš Pecka
Browse files

remove unwanted copies

parent aadc2dea
No related branches found
No related tags found
1 merge request!139merge tp
...@@ -66,7 +66,7 @@ bool SynchronizingWordExistence::exists ( const automaton::DFA < SymbolType, Sta ...@@ -66,7 +66,7 @@ bool SynchronizingWordExistence::exists ( const automaton::DFA < SymbolType, Sta
std::queue < ext::pair < StateType, StateType > > q; std::queue < ext::pair < StateType, StateType > > q;
ext::set < ext::pair < StateType, StateType > > visited; 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 ) if ( state.first != state.second )
continue; continue;
   
...@@ -78,7 +78,7 @@ bool SynchronizingWordExistence::exists ( const automaton::DFA < SymbolType, Sta ...@@ -78,7 +78,7 @@ bool SynchronizingWordExistence::exists ( const automaton::DFA < SymbolType, Sta
const ext::pair < StateType, StateType > cstate = std::move ( q.front ( ) ); const ext::pair < StateType, StateType > cstate = std::move ( q.front ( ) );
q.pop ( ); q.pop ( );
   
for ( const auto transition : cart.getTransitionsToState ( cstate ) ) { for ( const auto & transition : cart.getTransitionsToState ( cstate ) ) {
const auto & srcState = transition.first.first; const auto & srcState = transition.first.first;
   
if ( visited.count ( srcState ) == 0 ) { if ( visited.count ( srcState ) == 0 ) {
......
...@@ -72,7 +72,7 @@ template < class SymbolType > ...@@ -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) { 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); 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(); ext::set<SymbolType> alphabet_without_wildcard = pattern.getAlphabet();
alphabet_without_wildcard.erase(wildcard); alphabet_without_wildcard.erase(wildcard);
   
......
...@@ -61,7 +61,7 @@ template < class SymbolType > ...@@ -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> > 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); 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(); ext::set<SymbolType> alphabet_without_wildcard = pattern.getAlphabet();
alphabet_without_wildcard.erase(wildcard); alphabet_without_wildcard.erase(wildcard);
   
......
...@@ -64,7 +64,7 @@ SuffixTrieNodeTerminatingSymbol & SuffixTrieNodeTerminatingSymbol::operator =( S ...@@ -64,7 +64,7 @@ SuffixTrieNodeTerminatingSymbol & SuffixTrieNodeTerminatingSymbol::operator =( S
} }
   
SuffixTrieNodeTerminatingSymbol::~SuffixTrieNodeTerminatingSymbol ( ) noexcept { SuffixTrieNodeTerminatingSymbol::~SuffixTrieNodeTerminatingSymbol ( ) noexcept {
for ( auto element : m_children ) for ( const auto& element : m_children )
delete element.second; delete element.second;
   
m_children.clear ( ); m_children.clear ( );
......
...@@ -161,15 +161,15 @@ static Flow fordfulkerson_impl_dir(const DirectedGraph &graph, ...@@ -161,15 +161,15 @@ static Flow fordfulkerson_impl_dir(const DirectedGraph &graph,
updateFlow_dir(source, sink, ctx); updateFlow_dir(source, sink, ctx);
   
// assign negative flow for the reversed pairs of nodes ? // assign negative flow for the reversed pairs of nodes ?
for (auto u : ctx.flow) for (auto& u : ctx.flow)
for (auto v : u.second) for (auto& v : u.second)
if (ctx.flow[u.first][v.first] != 0) if (ctx.flow[u.first][v.first] != 0)
ctx.flow[v.first][u.first] = -ctx.flow[u.first][v.first]; ctx.flow[v.first][u.first] = -ctx.flow[u.first][v.first];
   
return ctx.flow; 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; DirectedGraph graph;
   
for (auto &node: ugraph.getNodes()) { for (auto &node: ugraph.getNodes()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment