diff --git a/alib2algo/src/arbology/exact/ExactPatternMatch.h b/alib2algo/src/arbology/exact/ExactPatternMatch.h
index db7486a2b4ff6c9bcde998860ca788928aa05816..d35d71b4b10d6e30c59afcc9b2926884fe6c3615 100644
--- a/alib2algo/src/arbology/exact/ExactPatternMatch.h
+++ b/alib2algo/src/arbology/exact/ExactPatternMatch.h
@@ -82,7 +82,7 @@ bool ExactPatternMatch::matchHelper ( const ext::tree < SymbolType > & subject,
 
 	if ( subject.getChildren ( ).size ( ) != pattern.getChildren ( ).size ( ) ) return false;
 
-	for ( const ext::tuple < const ext::tree < SymbolType >, const ext::tree < SymbolType > > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
+	for ( const ext::tuple < const ext::tree < SymbolType > &, const ext::tree < SymbolType > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
 		if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ), subtreeVariable ) ) return false;
 
 	return true;
@@ -95,7 +95,7 @@ bool ExactPatternMatch::matchHelper ( const ext::tree < common::ranked_symbol <
 	if ( subject.getData ( ) != pattern.getData ( ) ) return false;
 
 	 // ranked symbols are the same; test for number of children is not needed
-	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < SymbolType, RankType > > > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
+	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > > &, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
 		if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ), subtreeVariable ) ) return false;
 
 	return true;
@@ -118,7 +118,7 @@ bool ExactPatternMatch::matchHelper ( const ext::tree < common::ranked_symbol <
 	if ( subject.getData ( ) != pattern.getData ( ) ) return false;
 
 	 // ranked symbols are the same; test for number of children is not needed
-	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < unsigned, RankType > > > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ), repeats.getChildren ( ) ) )
+	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > > &, const ext::tree < common::ranked_symbol < SymbolType, RankType > > &, const ext::tree < common::ranked_symbol < unsigned, RankType > > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ), repeats.getChildren ( ) ) )
 		if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ), subtreeVariable, nonlinearVariables, std::get < 2 > ( childs ), variablesSetting ) ) return false;
 
 	return true;
@@ -152,7 +152,7 @@ void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned >
 
 	index++;
 
-	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < unsigned, RankType > > > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), repeats.getChildren ( ) ) )
+	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > > &, const ext::tree < common::ranked_symbol < unsigned, RankType > > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), repeats.getChildren ( ) ) )
 		matchInternal ( index, occ, std::get < 0 > ( childs ), pattern, subtreeVariable, nonlinearVariables, std::get < 1 > ( childs ) );
 }
 
diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatch.h b/alib2algo/src/arbology/exact/ExactSubtreeMatch.h
index cddeaf6a732dc4d54a5f5e515fe42945f8e22b86..79824f7548b0acaccb7677bd931be7eabdac2518 100644
--- a/alib2algo/src/arbology/exact/ExactSubtreeMatch.h
+++ b/alib2algo/src/arbology/exact/ExactSubtreeMatch.h
@@ -56,7 +56,7 @@ bool ExactSubtreeMatch::matchHelper ( const ext::tree < SymbolType > & subject,
 
 	if ( subject.getChildren ( ).size ( ) != pattern.getChildren ( ).size ( ) ) return false;
 
-	for ( const ext::tuple < const ext::tree < SymbolType >, const ext::tree < SymbolType > > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
+	for ( const ext::tuple < const ext::tree < SymbolType > &, const ext::tree < SymbolType > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
 		if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ) ) ) return false;
 
 	return true;
@@ -67,7 +67,7 @@ bool ExactSubtreeMatch::matchHelper ( const ext::tree < common::ranked_symbol <
 	if ( subject.getData ( ) != pattern.getData ( ) ) return false;
 
 	 // ranked symbols are the same; test for number of children is not needed
-	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < SymbolType, RankType > > > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
+	for ( const ext::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > > &, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) )
 		if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ) ) ) return false;
 
 	return true;
diff --git a/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.hxx b/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.hxx
index b98ef7c8753fa56966e2486fe7a667d5d0f15c60..8757e2d92f7a819adab9d32a9e6a1704efbf57e0 100644
--- a/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.hxx
+++ b/alib2algo/src/automaton/determinize/DeterminizeNFTAPart.hxx
@@ -20,7 +20,7 @@ void constructTransitions ( const std::pair < const ext::pair < common::ranked_s
 	} else {
 		const StateType & nftaState = transition.first.second [ i ];
 
-		for ( const std::pair < StateType, ext::set < StateType > > & dftaState : nftaStateToDftaStates.equal_range ( nftaState ) ) {
+		for ( const std::pair < const StateType, ext::set < StateType > > & dftaState : nftaStateToDftaStates.equal_range ( nftaState ) ) {
 			transitionLHS.push_back ( dftaState.second );
 			constructTransitions ( transition, i + 1, nftaStateToDftaStates, transitionLHS, resultTransition );
 			transitionLHS.pop_back ( );
diff --git a/alib2algo/src/automaton/generate/RandomizeAutomaton.h b/alib2algo/src/automaton/generate/RandomizeAutomaton.h
index 493142c9c9096d44a6aa0c6df262a8c632884055..1e34bd71a1537f7010d372ab23371410c40477ec 100644
--- a/alib2algo/src/automaton/generate/RandomizeAutomaton.h
+++ b/alib2algo/src/automaton/generate/RandomizeAutomaton.h
@@ -82,7 +82,7 @@ automaton::DFA < SymbolType, StateType > RandomizeAutomaton::randomize(const aut
 	for ( const StateType & finalState : fsm.getFinalStates ( ) )
 		res.addFinalState ( statePermutationMap.find ( finalState )->second );
 
-	for ( const std::pair < std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) )
+	for ( const std::pair < const ext::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) )
 		res.addTransition ( statePermutationMap.find ( transition.first.first )->second, transition.first.second, statePermutationMap.find ( transition.second )->second );
 
 	return res;
@@ -103,7 +103,7 @@ automaton::MultiInitialStateNFA < SymbolType, StateType > RandomizeAutomaton::ra
 	for ( const StateType & finalState : fsm.getFinalStates ( ) )
 		res.addFinalState ( statePermutationMap.find ( finalState )->second );
 
-	for ( const std::pair < std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) )
+	for ( const std::pair < const std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) )
 		res.addTransition ( statePermutationMap.find ( transition.first.first )->second, transition.first.second, statePermutationMap.find ( transition.second )->second );
 
 	return res;
@@ -121,7 +121,7 @@ automaton::NFA < SymbolType, StateType > RandomizeAutomaton::randomize(const aut
 	for ( const StateType & finalState : fsm.getFinalStates ( ) )
 		res.addFinalState ( statePermutationMap.find ( finalState )->second );
 
-	for ( const std::pair < std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) )
+	for ( const std::pair < const std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) )
 		res.addTransition ( statePermutationMap.find ( transition.first.first )->second, transition.first.second, statePermutationMap.find ( transition.second )->second );
 
 	return res;
@@ -139,7 +139,7 @@ automaton::EpsilonNFA < SymbolType, StateType > RandomizeAutomaton::randomize( c
 	for ( const StateType & finalState : fsm.getFinalStates ( ) )
 		res.addFinalState ( statePermutationMap.find ( finalState )->second );
 
-	for ( const std::pair < std::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : fsm.getTransitions ( ) )
+	for ( const std::pair < const std::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : fsm.getTransitions ( ) )
 		res.addTransition ( statePermutationMap.find ( transition.first.first )->second, transition.first.second, statePermutationMap.find ( transition.second )->second );
 
 	return res;
diff --git a/alib2algo/src/automaton/properties/AllEpsilonClosure.h b/alib2algo/src/automaton/properties/AllEpsilonClosure.h
index c1111a8d05e600bf0e0a55223ad7aaff35d7b04b..30d3ad40e4737eee00c2753b986a2df18f451683 100644
--- a/alib2algo/src/automaton/properties/AllEpsilonClosure.h
+++ b/alib2algo/src/automaton/properties/AllEpsilonClosure.h
@@ -185,7 +185,7 @@ ext::map<StateType, ext::set<StateType>> AllEpsilonClosure::allEpsilonClosure( c
 	ext::map<StateType, ext::set<StateType>> res;
 	ext::map<StateType, ext::set<StateType>> step;
 
-	for(const std::pair<const std::pair<StateType, regexp::UnboundedRegExpStructure < SymbolType > >, StateType >& transition : fsm.getTransitions() )
+	for(const std::pair<const ext::pair<StateType, regexp::UnboundedRegExpStructure < SymbolType > >, StateType >& transition : fsm.getTransitions() )
 		if( regexp::properties::RegExpEpsilon::languageContainsEpsilon( transition.first.second ) )
 			step[transition.first.first].insert(transition.second);
 
@@ -208,7 +208,7 @@ ext::map<StateType, ext::set<StateType>> AllEpsilonClosure::allEpsilonClosure( c
 	ext::map<StateType, ext::set<StateType>> res;
 	ext::map<StateType, ext::set<StateType>> step;
 
-	for(const std::pair<const std::pair<StateType, ext::vector < SymbolType > >, StateType >& transition : fsm.getTransitions() )
+	for(const std::pair<const ext::pair<StateType, ext::vector < SymbolType > >, StateType >& transition : fsm.getTransitions() )
 		if( transition.first.second.empty ( ) )
 			step[transition.first.first].insert(transition.second);
 
diff --git a/alib2algo/src/automaton/properties/DistinguishableStates.h b/alib2algo/src/automaton/properties/DistinguishableStates.h
index 49512684ec839fc239dc471825219fa7a45354cc..6a0687fdd7f78c50a2a91df57e29b02bbfc5a2da 100644
--- a/alib2algo/src/automaton/properties/DistinguishableStates.h
+++ b/alib2algo/src/automaton/properties/DistinguishableStates.h
@@ -118,7 +118,7 @@ ext::set < ext::pair < StateType, StateType > > DistinguishableStates::distingui
 				if ( distinguishable.count ( ext::make_pair ( a, b ) ) )
 					continue;
 
-				for ( const std::pair < ext::pair < common::ranked_symbol < SymbolType, RankType >, ext::vector < StateType > >, StateType > & transition : fta.getTransitions ( ) ) {
+				for ( const std::pair < const ext::pair < common::ranked_symbol < SymbolType, RankType >, ext::vector < StateType > >, StateType > & transition : fta.getTransitions ( ) ) {
 					for ( size_t i = 0; i < transition.first.second.size ( ); ++ i ) {
 						if ( transition.first.second [ i ] == a ) {
 							ext::vector < StateType > copy = transition.first.second;
diff --git a/alib2algo/src/automaton/properties/UndistinguishableStates.h b/alib2algo/src/automaton/properties/UndistinguishableStates.h
index 8d1379eb18873fc528f92d5d53a1931c416c495a..2f7c334afba232c81fa497bd95e1b011a865024c 100644
--- a/alib2algo/src/automaton/properties/UndistinguishableStates.h
+++ b/alib2algo/src/automaton/properties/UndistinguishableStates.h
@@ -108,7 +108,7 @@ ext::set < ext::set < StateType > > UndistinguishableStates::undistinguishable (
 		ext::set < ext::pair < StateType, StateType > > undistinguishable2 = undistinguishable;
 
 		for ( const ext::pair < StateType, StateType > & iter : undistinguishable2 ) {
-			for ( const std::pair < ext::pair < StateType, SymbolType >, StateType > & transition : dfa.getTransitions ( ) ) {
+			for ( const std::pair < const ext::pair < StateType, SymbolType >, StateType > & transition : dfa.getTransitions ( ) ) {
 				if ( transition.first.first == iter . first ) {
 
 					const auto & transition2 = dfa.getTransitions ( ).find ( std::make_pair ( iter.second, transition.first.second ) );
@@ -138,7 +138,7 @@ ext::set < ext::set < StateType > > UndistinguishableStates::undistinguishable (
 		ext::set < ext::pair < StateType, StateType > > undistinguishable2 = undistinguishable;
 
 		for ( const ext::pair < StateType, StateType > & iter : undistinguishable2 ) {
-			for ( const std::pair < ext::pair < common::ranked_symbol < SymbolType, RankType >, ext::vector < StateType > >, StateType > & transition : fta.getTransitions ( ) ) {
+			for ( const std::pair < const ext::pair < common::ranked_symbol < SymbolType, RankType >, ext::vector < StateType > >, StateType > & transition : fta.getTransitions ( ) ) {
 				for ( size_t i = 0; i < transition.first.second.size ( ); ++ i ) {
 					if ( transition.first.second [ i ] == iter . first ) {
 						ext::vector < StateType > copy = transition.first.second;
diff --git a/alib2algo/src/automaton/simplify/Minimize.h b/alib2algo/src/automaton/simplify/Minimize.h
index d05210f0f05cce6121bb03fdae3a0c7b8158c908..af5cb1aa7cf16bc9ef7ec8f746738f5b37db48fc 100644
--- a/alib2algo/src/automaton/simplify/Minimize.h
+++ b/alib2algo/src/automaton/simplify/Minimize.h
@@ -121,7 +121,7 @@ automaton::DFA < SymbolType, StateType > Minimize::minimize(const automaton::DFA
 	for(const StateType& state : dfa.getStates())
 		refactor.insert(std::make_pair(state, ext::map<SymbolType, StateType>()));
 
-	for(const std::pair<const std::pair<StateType, SymbolType>, StateType>& transition : dfa.getTransitions())
+	for(const std::pair<const ext::pair<StateType, SymbolType>, StateType>& transition : dfa.getTransitions())
 		refactor[transition.first.first].insert(std::make_pair(transition.first.second, transition.second));
 
 	ext::map<StateType, StateType> toEquivalentStates; //original state to equivalent state
diff --git a/alib2algo/src/automaton/simplify/MinimizeVerbose.h b/alib2algo/src/automaton/simplify/MinimizeVerbose.h
index 59f17fa16195864d9a8f89bc27ab8c83a29c615a..b59fe3e90bc24796d47939da73815b56427d0d3a 100644
--- a/alib2algo/src/automaton/simplify/MinimizeVerbose.h
+++ b/alib2algo/src/automaton/simplify/MinimizeVerbose.h
@@ -75,7 +75,7 @@ ext::vector < ext::map < std::pair < StateType, StateType >, ext::map < SymbolTy
 	for(const StateType& state : dfa.getStates())
 		refactor.insert(std::make_pair(state, ext::map<SymbolType, StateType>()));
 
-	for(const std::pair<const std::pair<StateType, SymbolType>, StateType>& transition : dfa.getTransitions())
+	for(const std::pair<const ext::pair<StateType, SymbolType>, StateType>& transition : dfa.getTransitions())
 		refactor[transition.first.first].insert(std::make_pair(transition.first.second, transition.second));
 
 	ext::map<StateType, StateType> toEquivalentStates; //original state to equivalent state
diff --git a/alib2algo/src/automaton/simplify/Normalize.h b/alib2algo/src/automaton/simplify/Normalize.h
index b99c12ed3a1da9da8e44657c7f121c94456e2061..f6e48ad6aefa8ba1f60158badade1eae72de0f6b 100644
--- a/alib2algo/src/automaton/simplify/Normalize.h
+++ b/alib2algo/src/automaton/simplify/Normalize.h
@@ -117,7 +117,7 @@ automaton::DFA < SymbolType, unsigned > Normalize::normalize(const automaton::DF
 		processingData.pop_front();
 
 		// Transitions are trivialy sorted by input symbol (from state is the same)
-		for(const std::pair < const std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitionsFromState(current) ) {
+		for(const std::pair < const ext::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitionsFromState(current) ) {
 			if(normalizationData.find(transition.second) == normalizationData.end()) {
 				normalizationData.insert ( std::make_pair ( transition.second, counter++ ) );
 				processingData.push_back ( transition.second );
@@ -141,7 +141,7 @@ automaton::DFA < SymbolType, unsigned > Normalize::normalize(const automaton::DF
 		result.addFinalState( normalizationData.find ( finalState )->second );
 	}
 
-	for(const std::pair < const std::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) ) {
+	for(const std::pair < const ext::pair < StateType, SymbolType >, StateType > & transition : fsm.getTransitions ( ) ) {
 		result.addTransition ( normalizationData.find ( transition.first.first )->second, transition.first.second, normalizationData.find ( transition.second )->second );
 	}
 
@@ -162,7 +162,7 @@ automaton::CompactDFA < SymbolType, unsigned > Normalize::normalize ( const auto
 		processingData.pop_front ( );
 
 		// Transitions are trivialy sorted by input sequence (from state is the same)
-		for ( const std::pair < const std::pair < StateType, ext::vector < SymbolType > >, StateType > & transition : fsm.getTransitionsFromState ( current ) ) {
+		for ( const std::pair < const ext::pair < StateType, ext::vector < SymbolType > >, StateType > & transition : fsm.getTransitionsFromState ( current ) ) {
 			if ( normalizationData.find ( transition.second ) == normalizationData.end ( ) ) {
 				normalizationData.insert ( std::make_pair ( transition.second, counter ++ ) );
 				processingData.push_back ( transition.second );
@@ -186,7 +186,7 @@ automaton::CompactDFA < SymbolType, unsigned > Normalize::normalize ( const auto
 		result.addFinalState( normalizationData.find ( finalState )->second );
 	}
 
-	for ( const std::pair < const std::pair < StateType, ext::vector < SymbolType > >, StateType > & transition : fsm.getTransitions ( ) ) {
+	for ( const std::pair < const ext::pair < StateType, ext::vector < SymbolType > >, StateType > & transition : fsm.getTransitions ( ) ) {
 		result.addTransition ( normalizationData.find ( transition.first.first )->second, transition.first.second, normalizationData.find ( transition.second )->second );
 	}
 
@@ -212,7 +212,7 @@ automaton::DPDA < InputSymbolType, unsigned, unsigned > Normalize::normalize(con
 		ext::map < std::pair < common::symbol_or_epsilon < InputSymbolType >, ext::vector < unsigned > >, std::pair < StateType, ext::vector < PushdownStoreSymbolType > > > transform;
 		bool stateFinished = true;
 		// For each transition from state current
-		for ( const std::pair < const ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, std::pair < StateType, ext::vector < PushdownStoreSymbolType > > > & iter : pda.getTransitionsFromState(current)) {
+		for ( const std::pair < const ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > & iter : pda.getTransitionsFromState(current)) {
 			// look whether all pop symbols are already transformed
 			if(std::all_of(std::get<2>(iter.first).begin(), std::get<2>(iter.first).end(), [&](const PushdownStoreSymbolType& symbol) { return normalizationDataSymbol.find(symbol) != normalizationDataSymbol.end(); })) {
 				ext::vector < unsigned > transformedSymbols;
diff --git a/alib2algo/src/grammar/generate/RandomizeGrammar.h b/alib2algo/src/grammar/generate/RandomizeGrammar.h
index c6a512b90e17ef6c08656e9318b6a293be6e5bea..63abfa9f835b11f19d173875258be282463d868c 100644
--- a/alib2algo/src/grammar/generate/RandomizeGrammar.h
+++ b/alib2algo/src/grammar/generate/RandomizeGrammar.h
@@ -70,7 +70,7 @@ grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > RandomizeGrammar::
 	res.setNonterminalAlphabet ( gram.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( gram.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < NonterminalSymbolType, TerminalSymbolType > > > > & rule : gram.getRules ( ) )
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < NonterminalSymbolType, TerminalSymbolType > > > > & rule : gram.getRules ( ) )
 		for ( const ext::variant < TerminalSymbolType, ext::pair < NonterminalSymbolType, NonterminalSymbolType > > & rhs : rule.second )
 			if ( rhs.template is < TerminalSymbolType > ( ) )
 				res.addRule ( symbolPermutationMap.at ( rule.first ), rhs );
@@ -89,7 +89,7 @@ grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > RandomizeGrammar::
 	res.setNonterminalAlphabet ( gram.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( gram.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::pair < NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > & rule : gram.getRules ( ) )
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::pair < NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > & rule : gram.getRules ( ) )
 		for ( const ext::variant < ext::vector < TerminalSymbolType >, ext::pair < NonterminalSymbolType, ext::vector < TerminalSymbolType > > > & rhs : rule.second )
 			if ( rhs.template is < ext::vector < TerminalSymbolType > > ( ) )
 				res.addRule ( symbolPermutationMap.at ( rule.first ), rhs );
@@ -108,7 +108,7 @@ grammar::RightRG < TerminalSymbolType, NonterminalSymbolType > RandomizeGrammar:
 	res.setNonterminalAlphabet ( gram.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( gram.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < TerminalSymbolType, NonterminalSymbolType > > > > & rule : gram.getRules ( ) )
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < TerminalSymbolType, NonterminalSymbolType > > > > & rule : gram.getRules ( ) )
 		for ( const ext::variant < TerminalSymbolType, ext::pair < TerminalSymbolType, NonterminalSymbolType > > & rhs : rule.second )
 			if ( rhs.template is < TerminalSymbolType > ( ) )
 				res.addRule ( symbolPermutationMap.at ( rule.first ), rhs );
@@ -127,7 +127,7 @@ grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > RandomizeGrammar:
 	res.setNonterminalAlphabet ( gram.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( gram.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::pair < ext::vector < TerminalSymbolType >, NonterminalSymbolType > > > > & rule : gram.getRules ( ) )
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::pair < ext::vector < TerminalSymbolType >, NonterminalSymbolType > > > > & rule : gram.getRules ( ) )
 		for ( const ext::variant < ext::vector < TerminalSymbolType >, ext::pair < ext::vector < TerminalSymbolType >, NonterminalSymbolType > > & rhs : rule.second )
 			if ( rhs.template is < ext::vector < TerminalSymbolType > > ( ) )
 				res.addRule ( symbolPermutationMap.at ( rule.first ), rhs );
@@ -146,7 +146,7 @@ grammar::CFG < TerminalSymbolType, NonterminalSymbolType > RandomizeGrammar::ran
 	res.setNonterminalAlphabet ( gram.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( gram.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > & rule : gram.getRules ( ) )
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > & rule : gram.getRules ( ) )
 		for ( const ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > & rhs : rule.second )
 			res.addRule ( symbolPermutationMap.find ( rule.first )->second, ext::transform < ext::variant < TerminalSymbolType, NonterminalSymbolType > > ( rhs, [ & ] ( const ext::variant < TerminalSymbolType, NonterminalSymbolType > & elem ) {
 						if ( gram.getNonterminalAlphabet ( ).count ( elem ) )
diff --git a/alib2algo/src/grammar/simplify/ToCNF.h b/alib2algo/src/grammar/simplify/ToCNF.h
index c9368b66097c517144ae5fea942225acb73eb774..8e8f1af61802c3b585513be700964df8279b4c99 100644
--- a/alib2algo/src/grammar/simplify/ToCNF.h
+++ b/alib2algo/src/grammar/simplify/ToCNF.h
@@ -174,7 +174,7 @@ grammar::CNF < TerminalSymbolType,  ext::variant < TerminalSymbolType, Nontermin
 		result.addRule ( std::move ( shadowSymbol ), symbol );
 	}
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < NonterminalSymbolType, TerminalSymbolType > > > > & rules : grammar.getRules ( ) ) {
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < NonterminalSymbolType, TerminalSymbolType > > > > & rules : grammar.getRules ( ) ) {
 		for ( const ext::variant < TerminalSymbolType, ext::pair < NonterminalSymbolType, TerminalSymbolType > > & rhs : rules.second ) {
 			if ( rhs.template is < TerminalSymbolType > ( ) ) {
 				result.addRule ( rules.first, rhs.template get < TerminalSymbolType > ( ) );
@@ -206,7 +206,7 @@ grammar::CNF < TerminalSymbolType,  ext::variant < TerminalSymbolType, Nontermin
 		result.addRule ( std::move ( shadowSymbol ), symbol );
 	}
 
-	for ( const std::pair < NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < TerminalSymbolType, NonterminalSymbolType > > > > & rules : grammar.getRules ( ) ) {
+	for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < TerminalSymbolType, ext::pair < TerminalSymbolType, NonterminalSymbolType > > > > & rules : grammar.getRules ( ) ) {
 		for ( const ext::variant < TerminalSymbolType, ext::pair < TerminalSymbolType, NonterminalSymbolType > > & rhs : rules.second ) {
 			if ( rhs.template is < TerminalSymbolType > ( ) ) {
 				result.addRule ( rules.first, rhs.template get < TerminalSymbolType > ( ) );
diff --git a/alib2algo/src/stringology/properties/BackboneLength.h b/alib2algo/src/stringology/properties/BackboneLength.h
index 1d6cb437cfe4e340c066ba508f59277ca965751d..49daf9e0bb168fc124369ea08195f92a9253e11f 100644
--- a/alib2algo/src/stringology/properties/BackboneLength.h
+++ b/alib2algo/src/stringology/properties/BackboneLength.h
@@ -56,7 +56,7 @@ unsigned BackboneLength::length ( const automaton::DFA < SymbolType, StateType >
 		dist = current.second;
 		max = std::max ( max, current.second );
 
-		for ( const std::pair < const std::pair < StateType, SymbolType >, StateType > & target : automaton.getTransitionsFromState ( current.first ) )
+		for ( const std::pair < const ext::pair < StateType, SymbolType >, StateType > & target : automaton.getTransitionsFromState ( current.first ) )
 			open.push ( std::make_pair ( target.second, current.second + 1 ) );
 	}
 
diff --git a/alib2algo/src/stringology/query/PositionHeapFactors.h b/alib2algo/src/stringology/query/PositionHeapFactors.h
index 0967d8d9c6fc827ae0d2354e3356b7b3d852614e..ed56f9d9cd665cb2e7045c4078b59cb506a9b73e 100644
--- a/alib2algo/src/stringology/query/PositionHeapFactors.h
+++ b/alib2algo/src/stringology/query/PositionHeapFactors.h
@@ -29,7 +29,7 @@ class PositionHeapFactors {
 	static void accumulateResult ( const ext::trie < SymbolType, unsigned > & trie, ext::set < unsigned > & res, unsigned indexedStringSize ) {
 		res.insert ( indexedStringSize - trie.getData ( ) );
 
-		for ( const std::pair < SymbolType, ext::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) {
+		for ( const std::pair < const SymbolType, ext::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) {
 			accumulateResult ( child.second, res, indexedStringSize );
 		}
 	}
diff --git a/alib2algo/src/stringology/query/SuffixTrieFactors.h b/alib2algo/src/stringology/query/SuffixTrieFactors.h
index 69356d1f47a2edd88f8932303ffe377094f99e51..e9eb4bbbdffc10578df0cb1b10c32d5f12896cf1 100644
--- a/alib2algo/src/stringology/query/SuffixTrieFactors.h
+++ b/alib2algo/src/stringology/query/SuffixTrieFactors.h
@@ -27,7 +27,7 @@ class SuffixTrieFactors {
 		if ( trie.getData ( ) )
 			res.insert ( trie.getData ( ).value ( ) );
 
-		for ( const std::pair < SymbolType, ext::trie < SymbolType, ext::optional < unsigned > > > & child : trie.getChildren ( ) ) {
+		for ( const std::pair < const SymbolType, ext::trie < SymbolType, ext::optional < unsigned > > > & child : trie.getChildren ( ) ) {
 			accumulateResult ( child.second, res );
 		}
 	}
diff --git a/alib2algo/src/tree/generate/RandomTreeFactory.cpp b/alib2algo/src/tree/generate/RandomTreeFactory.cpp
index 9f2729042bb3f12c827ea17dd47fd5d2652bfc00..a6dfda0e4d9ee013940dff3f2687d7a3dac05d97 100644
--- a/alib2algo/src/tree/generate/RandomTreeFactory.cpp
+++ b/alib2algo/src/tree/generate/RandomTreeFactory.cpp
@@ -335,7 +335,7 @@ RankedTree < > RandomRankedTreeFactory::generateRankedTree ( int depth, int node
 
 	ext::set < common::ranked_symbol < > > treeRankedAlphabet;
 
-	for ( const std::pair < int, ext::vector < char > > & it : rankedAlphabet )
+	for ( const std::pair < const int, ext::vector < char > > & it : rankedAlphabet )
 		for ( char i : it.second )
 			treeRankedAlphabet.insert ( common::ranked_symbol < > ( DefaultSymbolType ( i ), DefaultRankType ( it.first ) ) );
 
@@ -356,7 +356,7 @@ RankedPattern < > RandomRankedPatternFactory::generateRankedPattern ( int depth,
 
 	ext::set < common::ranked_symbol < > > treeRankedAlphabet;
 
-	for ( const std::pair < int, ext::vector < char > > & it : rankedAlphabet )
+	for ( const std::pair < const int, ext::vector < char > > & it : rankedAlphabet )
 		for ( char i : it.second )
 			treeRankedAlphabet.insert ( common::ranked_symbol < > ( DefaultSymbolType ( i ), DefaultRankType ( it.first ) ) );
 
@@ -380,7 +380,7 @@ RankedNonlinearPattern < > RandomRankedNonlinearPatternFactory::generateRankedNo
 	ext::set < common::ranked_symbol < > > treeRankedAlphabet;
 	ext::set < common::ranked_symbol < > > nonlinearVariables;
 
-	for ( const std::pair < int, ext::vector < char > > & it : rankedAlphabet )
+	for ( const std::pair < const int, ext::vector < char > > & it : rankedAlphabet )
 		for ( char i : it.second )
 			treeRankedAlphabet.insert ( common::ranked_symbol < > ( DefaultSymbolType ( i ), DefaultRankType ( it.first ) ) );