From dbd39826c3956585d35632a122811d039d1d241c Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Wed, 13 Apr 2016 08:24:02 +0200
Subject: [PATCH] do not copy in const foreach loops

---
 alib2algo/src/automaton/simplify/Rename.cpp      |  2 +-
 .../src/grammar/generate/CockeYoungerKasami.cpp  |  4 ++--
 .../src/grammar/parsing/AbsorbTerminalSymbol.cpp |  2 +-
 .../src/grammar/parsing/CornerSubstitution.cpp   |  2 +-
 .../grammar/parsing/DeterministicLL1Grammar.cpp  |  6 +++---
 .../parsing/DeterministicLL1ParseTable.cpp       |  4 ++--
 .../src/grammar/parsing/ExtractRightContext.cpp  |  2 +-
 alib2algo/src/grammar/parsing/First.cpp          |  4 ++--
 alib2algo/src/grammar/parsing/Follow.cpp         |  2 +-
 .../parsing/HandleFirstFollowConflict.cpp        |  4 ++--
 alib2algo/src/grammar/parsing/LL1ParseTable.cpp  |  2 +-
 alib2algo/src/grammar/parsing/LeftFactorize.cpp  |  2 +-
 alib2common/src/XmlApi.hpp                       |  4 ++--
 alib2common/src/cast/CastApi.hpp                 |  2 +-
 alib2data/src/automaton/PDA/DPDA.cpp             | 14 +++++++-------
 alib2data/src/automaton/PDA/InputDrivenDPDA.cpp  | 10 +++++-----
 alib2data/src/automaton/PDA/InputDrivenNPDA.cpp  | 12 ++++++------
 alib2data/src/automaton/PDA/NPDA.cpp             |  6 +++---
 .../PDA/RealTimeHeightDeterministicDPDA.cpp      | 16 ++++++++--------
 .../PDA/RealTimeHeightDeterministicNPDA.cpp      | 16 ++++++++--------
 alib2data/src/automaton/PDA/SinglePopDPDA.cpp    |  6 +++---
 alib2data/src/automaton/PDA/SinglePopNPDA.cpp    |  8 ++++----
 .../src/automaton/PDA/VisiblyPushdownDPDA.cpp    | 16 ++++++++--------
 .../src/automaton/PDA/VisiblyPushdownNPDA.cpp    | 16 ++++++++--------
 alib2data/src/automaton/TA/DFTA.cpp              |  4 ++--
 alib2data/src/automaton/TA/NFTA.cpp              |  6 +++---
 alib2data/src/automaton/TM/OneTapeDTM.cpp        |  4 ++--
 alib2data/src/container/ObjectsMap.h             |  2 +-
 alib2data/src/grammar/ContextFree/CFG.cpp        |  6 +++---
 alib2data/src/grammar/ContextFree/CNF.cpp        |  4 ++--
 .../src/grammar/ContextFree/EpsilonFreeCFG.cpp   |  4 ++--
 alib2data/src/grammar/ContextFree/GNF.cpp        |  4 ++--
 alib2data/src/grammar/ContextFree/LG.cpp         |  4 ++--
 alib2data/src/grammar/ContextSensitive/CSG.cpp   |  4 ++--
 .../ContextSensitive/NonContractingGrammar.cpp   |  4 ++--
 .../ContextPreservingUnrestrictedGrammar.cpp     |  4 ++--
 .../grammar/Unrestricted/UnrestrictedGrammar.cpp |  4 ++--
 .../properties/efficient/AllEpsilonClosure.cpp   |  4 ++--
 .../efficient/EpsilonRemoverOutgoing.cpp         |  2 +-
 .../MeasurementProvisionerResultsXml.cpp         |  2 +-
 alib2std/src/extensions/map.hpp                  |  2 +-
 alib2std/src/extensions/unordered_map.hpp        |  2 +-
 42 files changed, 114 insertions(+), 114 deletions(-)

diff --git a/alib2algo/src/automaton/simplify/Rename.cpp b/alib2algo/src/automaton/simplify/Rename.cpp
index f39fc14d2a..0af82b627f 100644
--- a/alib2algo/src/automaton/simplify/Rename.cpp
+++ b/alib2algo/src/automaton/simplify/Rename.cpp
@@ -166,7 +166,7 @@ automaton::InputDrivenDPDA Rename::rename(const automaton::InputDrivenDPDA& pda)
 	result.setInputAlphabet(pda.getInputAlphabet());
 	result.setStackAlphabet(pda.getStackAlphabet());
 
-	for(const std::pair<alphabet::Symbol, std::pair<std::vector<alphabet::Symbol>, std::vector<alphabet::Symbol>>> operation : pda.getPushdownStoreOperations()) {
+	for(const std::pair<const alphabet::Symbol, std::pair<std::vector<alphabet::Symbol>, std::vector<alphabet::Symbol>>> operation : pda.getPushdownStoreOperations()) {
 		std::vector<alphabet::Symbol> pop;
 		for(const auto& elem : operation.second.first) {
 			pop.push_back(alphabet::symbolFrom(renamingDataSymbol.find(elem)->second));
diff --git a/alib2algo/src/grammar/generate/CockeYoungerKasami.cpp b/alib2algo/src/grammar/generate/CockeYoungerKasami.cpp
index 797b128eb7..8dc452f077 100644
--- a/alib2algo/src/grammar/generate/CockeYoungerKasami.cpp
+++ b/alib2algo/src/grammar/generate/CockeYoungerKasami.cpp
@@ -24,7 +24,7 @@ bool CockeYoungerKasami::generate ( const grammar::CNF & grammar, const string::
 		data[i].resize ( stringSize - i );
 
 	for ( unsigned i = 0; i < stringSize; i++ )
-		for ( const std::pair < alphabet::Symbol, std::set < std::variant < alphabet::Symbol, std::pair < alphabet::Symbol, alphabet::Symbol > > > > rule : grammar.getRules ( ) ) {
+		for ( const std::pair < const alphabet::Symbol, std::set < std::variant < alphabet::Symbol, std::pair < alphabet::Symbol, alphabet::Symbol > > > > rule : grammar.getRules ( ) ) {
 			const alphabet::Symbol & lhs = rule.first;
 
 			for ( const std::variant < alphabet::Symbol, std::pair < alphabet::Symbol, alphabet::Symbol > > rhs : rule.second )
@@ -46,7 +46,7 @@ bool CockeYoungerKasami::generate ( const grammar::CNF & grammar, const string::
 				for ( const alphabet::Symbol & verticalElement : vertical ) {
 					for ( const alphabet::Symbol & diagonalElement : diagonal )
 
-						for ( const std::pair < alphabet::Symbol, std::set < std::variant < alphabet::Symbol, std::pair < alphabet::Symbol, alphabet::Symbol > > > > rule : grammar.getRules ( ) ) {
+						for ( const std::pair < const alphabet::Symbol, std::set < std::variant < alphabet::Symbol, std::pair < alphabet::Symbol, alphabet::Symbol > > > > rule : grammar.getRules ( ) ) {
 							const alphabet::Symbol & lhs = rule.first;
 
 							for ( const std::variant < alphabet::Symbol, std::pair < alphabet::Symbol, alphabet::Symbol > > rhs : rule.second )
diff --git a/alib2algo/src/grammar/parsing/AbsorbTerminalSymbol.cpp b/alib2algo/src/grammar/parsing/AbsorbTerminalSymbol.cpp
index 596daa5172..cde24567c3 100644
--- a/alib2algo/src/grammar/parsing/AbsorbTerminalSymbol.cpp
+++ b/alib2algo/src/grammar/parsing/AbsorbTerminalSymbol.cpp
@@ -56,7 +56,7 @@ void AbsorbTerminalSymbol::absorbTerminalSymbol ( grammar::CFG & grammar, const
 
 	handleAbsobtion ( grammar, res, terminal, nonterminals, nonterminalsPrimed );
 
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
 		const alphabet::Symbol & lhs = rule.first;
 
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second ) {
diff --git a/alib2algo/src/grammar/parsing/CornerSubstitution.cpp b/alib2algo/src/grammar/parsing/CornerSubstitution.cpp
index eb113f2ec9..2717b9d44b 100644
--- a/alib2algo/src/grammar/parsing/CornerSubstitution.cpp
+++ b/alib2algo/src/grammar/parsing/CornerSubstitution.cpp
@@ -21,7 +21,7 @@ void CornerSubstitution::cornerSubstitution ( grammar::CFG & grammar, const alph
 	res.setNonterminalAlphabet ( grammar.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( grammar.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
 		const alphabet::Symbol & lhs = rule.first;
 
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second ) {
diff --git a/alib2algo/src/grammar/parsing/DeterministicLL1Grammar.cpp b/alib2algo/src/grammar/parsing/DeterministicLL1Grammar.cpp
index 8246ae13a2..46c4428c41 100644
--- a/alib2algo/src/grammar/parsing/DeterministicLL1Grammar.cpp
+++ b/alib2algo/src/grammar/parsing/DeterministicLL1Grammar.cpp
@@ -34,12 +34,12 @@ grammar::CFG DeterministicLL1Grammar::convert ( const grammar::CFG & param ) {
 
 		bool deterministic = true;
 
-		for ( const std::pair < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable )
+		for ( const std::pair < const std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable )
 			if ( elem.second.size ( ) > 1 )
 				if ( elem.first.first.is < string::Epsilon > ( ) )
 					throw exception::AlibException ( "Cant handle conflict in epsilon" );
 
-		for ( const std::pair < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable ) {
+		for ( const std::pair < const std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable ) {
 			if ( elem.first.first.is < string::Epsilon > ( ) ) continue;
 
 			const alphabet::Symbol & terminal = elem.first.first.get < alphabet::Symbol > ( );
@@ -57,7 +57,7 @@ grammar::CFG DeterministicLL1Grammar::convert ( const grammar::CFG & param ) {
 
 		if ( !deterministic ) continue;
 
-		for ( const std::pair < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable ) {
+		for ( const std::pair < const std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable ) {
 			if ( elem.first.first.is < string::Epsilon > ( ) ) continue;
 
 			const alphabet::Symbol & terminal = elem.first.first.get < alphabet::Symbol > ( );
diff --git a/alib2algo/src/grammar/parsing/DeterministicLL1ParseTable.cpp b/alib2algo/src/grammar/parsing/DeterministicLL1ParseTable.cpp
index 6d468178a3..076fd5e0b9 100644
--- a/alib2algo/src/grammar/parsing/DeterministicLL1ParseTable.cpp
+++ b/alib2algo/src/grammar/parsing/DeterministicLL1ParseTable.cpp
@@ -15,13 +15,13 @@ namespace parsing {
 
 std::map < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::vector < alphabet::Symbol > > DeterministicLL1ParseTable::parseTable ( const std::map < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & parseTable ) {
 
-	for ( const std::pair < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable )
+	for ( const std::pair < const std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable )
 		if ( elem.second.size ( ) > 1 )
 			throw exception::AlibException ( "Cant handle conflict in epsilon" );
 
 	std::map < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::vector < alphabet::Symbol > > res;
 
-	for ( const std::pair < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable )
+	for ( const std::pair < const std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alphabet::Symbol >, std::set < std::vector < alphabet::Symbol > > > & elem : parseTable )
 		if ( elem.second.size ( ) == 1 )
 			res.insert ( std::make_pair ( elem.first, * elem.second.begin ( ) ) );
 
diff --git a/alib2algo/src/grammar/parsing/ExtractRightContext.cpp b/alib2algo/src/grammar/parsing/ExtractRightContext.cpp
index 835c95a582..3705427499 100644
--- a/alib2algo/src/grammar/parsing/ExtractRightContext.cpp
+++ b/alib2algo/src/grammar/parsing/ExtractRightContext.cpp
@@ -20,7 +20,7 @@ void ExtractRightContext::extractRightContext ( grammar::CFG & grammar, const al
 	res.setNonterminalAlphabet ( grammar.getNonterminalAlphabet ( ) );
 	res.setTerminalAlphabet ( grammar.getTerminalAlphabet ( ) );
 
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
 		const alphabet::Symbol & lhs = rule.first;
 
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second ) {
diff --git a/alib2algo/src/grammar/parsing/First.cpp b/alib2algo/src/grammar/parsing/First.cpp
index 5ceb536b9b..b7abc26c0f 100644
--- a/alib2algo/src/grammar/parsing/First.cpp
+++ b/alib2algo/src/grammar/parsing/First.cpp
@@ -68,7 +68,7 @@ std::map < alphabet::Symbol, std::set < std::variant < alphabet::Symbol, string:
 	std::map < alphabet::Symbol, std::set < std::variant < alphabet::Symbol, string::Epsilon > > > firstOfNonterminal2 = firstOfNonterminal1;
 
 	do {
-		for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : rules )
+		for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : rules )
 			for ( const std::vector < alphabet::Symbol > & rhs : rule.second ) {
 				std::set < std::variant < alphabet::Symbol, string::Epsilon > > newFirst = first ( terminals, nonterminals, firstOfNonterminal1, rhs );
 				firstOfNonterminal2[rule.first].insert ( newFirst.begin ( ), newFirst.end ( ) );
@@ -90,7 +90,7 @@ std::map < std::vector < alphabet::Symbol >, std::set < std::variant < alphabet:
 
 	std::map < std::vector < alphabet::Symbol >, std::set < std::variant < alphabet::Symbol, string::Epsilon > > > res;
 
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRawRules ( ) )
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRawRules ( ) )
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second )
 			res.insert ( make_pair ( rhs, first ( grammar.getTerminalAlphabet ( ), grammar.getNonterminalAlphabet ( ), firstNt, rhs ) ) );
 
diff --git a/alib2algo/src/grammar/parsing/Follow.cpp b/alib2algo/src/grammar/parsing/Follow.cpp
index 258fa31c64..189c3fb670 100644
--- a/alib2algo/src/grammar/parsing/Follow.cpp
+++ b/alib2algo/src/grammar/parsing/Follow.cpp
@@ -28,7 +28,7 @@ namespace parsing {
 
 template < class T >
 void Follow::follow ( const T & grammar, std::map < alphabet::Symbol, std::set < std::variant < alphabet::Symbol, string::Epsilon > > > & followSet ) {
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRawRules ( ) ) {
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRawRules ( ) ) {
 		const alphabet::Symbol & X = rule.first;
 
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second )
diff --git a/alib2algo/src/grammar/parsing/HandleFirstFollowConflict.cpp b/alib2algo/src/grammar/parsing/HandleFirstFollowConflict.cpp
index 191baa592f..30fbe98455 100644
--- a/alib2algo/src/grammar/parsing/HandleFirstFollowConflict.cpp
+++ b/alib2algo/src/grammar/parsing/HandleFirstFollowConflict.cpp
@@ -29,7 +29,7 @@ void HandleFirstFollowConflict::handleFirstFollowConflict ( grammar::CFG & gramm
 	while ( true ) {
 		std::set < alphabet::Symbol > symbolsEndingWithNonterminalOld = symbolsEndingWithNonterminal;
 
-		for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
+		for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
 			const alphabet::Symbol & lhs = rule.first;
 
 			if ( Follow::follow ( grammar, lhs ).count ( terminal ) )
@@ -47,7 +47,7 @@ void HandleFirstFollowConflict::handleFirstFollowConflict ( grammar::CFG & gramm
 	}
 
 	 // find whether all occurrences of a symbol in symbolsEndingWithNonterminal are followed by terminal symbol (the paremeter)
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) )
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) )
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second ) {
 			if ( rhs.size ( ) > 0 )
 				for ( std::vector < alphabet::Symbol >::const_iterator iter = rhs.begin ( ); iter + 1 != rhs.end ( ); ++iter )
diff --git a/alib2algo/src/grammar/parsing/LL1ParseTable.cpp b/alib2algo/src/grammar/parsing/LL1ParseTable.cpp
index 0f7fc6aafc..b171f3c2e5 100644
--- a/alib2algo/src/grammar/parsing/LL1ParseTable.cpp
+++ b/alib2algo/src/grammar/parsing/LL1ParseTable.cpp
@@ -31,7 +31,7 @@ std::map < std::pair < std::variant < alphabet::Symbol, string::Epsilon >, alpha
 	std::map < std::vector < alphabet::Symbol >, std::set < std::variant < alphabet::Symbol, string::Epsilon > > > first = First::first ( grammar );
 	std::map < alphabet::Symbol, std::set < std::variant < alphabet::Symbol, string::Epsilon > > > follow = Follow::follow ( grammar );
 
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & transition : grammar.getRawRules ( ) ) {
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & transition : grammar.getRawRules ( ) ) {
 		const alphabet::Symbol & lhs = transition.first;
 
 		for ( const std::vector < alphabet::Symbol > & rhs : transition.second ) {
diff --git a/alib2algo/src/grammar/parsing/LeftFactorize.cpp b/alib2algo/src/grammar/parsing/LeftFactorize.cpp
index b608cfce5b..d13eab3287 100644
--- a/alib2algo/src/grammar/parsing/LeftFactorize.cpp
+++ b/alib2algo/src/grammar/parsing/LeftFactorize.cpp
@@ -22,7 +22,7 @@ void LeftFactorize::leftFactorize ( grammar::CFG & grammar, const alphabet::Symb
 	alphabet::Symbol primed = alphabet::createUniqueSymbol ( nonterminal, grammar.getTerminalAlphabet ( ), grammar.getNonterminalAlphabet ( ) );
 	res.addNonterminalSymbol ( primed );
 
-	for ( const std::pair < alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
+	for ( const std::pair < const alphabet::Symbol, std::set < std::vector < alphabet::Symbol > > > & rule : grammar.getRules ( ) ) {
 		const alphabet::Symbol & lhs = rule.first;
 
 		for ( const std::vector < alphabet::Symbol > & rhs : rule.second ) {
diff --git a/alib2common/src/XmlApi.hpp b/alib2common/src/XmlApi.hpp
index b6075eb2d0..32fe137a81 100644
--- a/alib2common/src/XmlApi.hpp
+++ b/alib2common/src/XmlApi.hpp
@@ -36,10 +36,10 @@ public:
 	}
 
 	~xmlApiInputContext ( ) {
-		for ( const std::pair < std::string, std::map < int, void * > > context : idToInstanceContexts ) {
+		for ( const std::pair < const std::string, std::map < int, void * > > context : idToInstanceContexts ) {
 			std::function < void ( void * ) > & deleteCallback = deleteCallbacks ( ).find ( context.first )->second;
 
-			for ( const std::pair < int, void * > entry : context.second )
+			for ( const std::pair < const int, void * > entry : context.second )
 				deleteCallback ( entry.second );
 		}
 	}
diff --git a/alib2common/src/cast/CastApi.hpp b/alib2common/src/cast/CastApi.hpp
index aa20ddda6f..d199ae6d03 100644
--- a/alib2common/src/cast/CastApi.hpp
+++ b/alib2common/src/cast/CastApi.hpp
@@ -65,7 +65,7 @@ private:
 	class CastPoolBaseMap : public std::map < std::type_index, CastPoolBase * > {
 	public:
 		~CastPoolBaseMap ( ) {
-			for ( const std::pair < std::type_index, CastPoolBase * > & item : * this )
+			for ( const std::pair < const std::type_index, CastPoolBase * > & item : * this )
 				delete item.second;
 		}
 
diff --git a/alib2data/src/automaton/PDA/DPDA.cpp b/alib2data/src/automaton/PDA/DPDA.cpp
index 043c549501..a8ba8c8bf7 100644
--- a/alib2data/src/automaton/PDA/DPDA.cpp
+++ b/alib2data/src/automaton/PDA/DPDA.cpp
@@ -41,7 +41,7 @@ bool DPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (state == std::get<0>(transition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if( transition.second.first == state)
@@ -52,7 +52,7 @@ bool DPDA::removeState(const State& state) {
 }
 
 bool DPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (std::get<1>(transition.first).is<alphabet::Symbol>() && symbol == std::get<1>(transition.first).get<alphabet::Symbol>())
 			throw AutomatonException("Symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -61,7 +61,7 @@ bool DPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool DPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		for (const alphabet::Symbol& popSymbol : std::get<2>(transition.first)) {
 			if (symbol == popSymbol)
 				throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
@@ -117,7 +117,7 @@ bool DPDA::addTransition(State from, std::variant<string::Epsilon, alphabet::Sym
 	}
 
 	if(std::get<1>(key).is<string::Epsilon>()) {
-		if(std::any_of(transitions.begin(), transitions.end(), [&](const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<automaton::State, std::vector<alphabet::Symbol> > > & transition) {
+		if(std::any_of(transitions.begin(), transitions.end(), [&](const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<automaton::State, std::vector<alphabet::Symbol> > > & transition) {
 				if(std::get<0>(transition.first) == std::get<0>(key)) {
 					const std::vector<alphabet::Symbol>& alpha = std::get<2>(transition.first);
 					const std::vector<alphabet::Symbol>& beta = std::get<2>(key);
@@ -134,7 +134,7 @@ bool DPDA::addTransition(State from, std::variant<string::Epsilon, alphabet::Sym
 			}))
 				throw exception::AlibException("Conflicting transition");
 	} else {
-		if(std::any_of(transitions.begin(), transitions.end(), [&](const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<automaton::State, std::vector<alphabet::Symbol> > > & transition) {
+		if(std::any_of(transitions.begin(), transitions.end(), [&](const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<automaton::State, std::vector<alphabet::Symbol> > > & transition) {
 				if(std::get<0>(transition.first) == std::get<0>(key) && ( std::get<1>(transition.first) == std::get<1>(key) || std::get<1>(transition.first).is<string::Epsilon>() )) {
 					const std::vector<alphabet::Symbol>& alpha = std::get<2>(transition.first);
 					const std::vector<alphabet::Symbol>& beta = std::get<2>(key);
@@ -205,7 +205,7 @@ std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std:
 		throw AutomatonException("State \"" + (std::string) from.getName() + "\" doesn't exist");
 
 	std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > > transitionsFromState;
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (std::get<0>(transition.first) == from) {
 			transitionsFromState.insert(std::make_pair(transition.first, transition.second));
 		}
@@ -219,7 +219,7 @@ std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std:
 		throw AutomatonException("State \"" + (std::string) to.getName() + "\" doesn't exist");
 
 	std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > > transitionsToState;
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (transition.second.first == to) {
 			transitionsToState.insert(std::make_pair(transition.first, transition.second));
 		}
diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.cpp b/alib2data/src/automaton/PDA/InputDrivenDPDA.cpp
index 459e45a3af..0f4248278c 100644
--- a/alib2data/src/automaton/PDA/InputDrivenDPDA.cpp
+++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.cpp
@@ -41,7 +41,7 @@ bool InputDrivenDPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& t : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& t : transitions) {
 		if (t.first.first == state || t.second == state)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 	}
@@ -50,7 +50,7 @@ bool InputDrivenDPDA::removeState(const State& state) {
 }
 
 bool InputDrivenDPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
 		if (transition.first.second == symbol)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used.");
 	}
@@ -112,7 +112,7 @@ void InputDrivenDPDA::setPushdownStoreOperations(std::map<alphabet::Symbol, std:
 }
 
 bool InputDrivenDPDA::clearPushdownStoreOperation(const alphabet::Symbol& input) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
 		if (transition.first.second == input)
 			throw AutomatonException("Input symbol \"" + (std::string) input + "\" is used.");
 	}
@@ -176,7 +176,7 @@ std::map<std::pair<State, alphabet::Symbol>, State > InputDrivenDPDA::getTransit
 		throw AutomatonException("State \"" + (std::string) from.getName() + "\" doesn't exist");
 
 	std::map<std::pair<State, alphabet::Symbol>, State> transitionsFromState;
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
 		if (transition.first.first == from) {
 			transitionsFromState.insert(transition);
 		}
@@ -190,7 +190,7 @@ std::map<std::pair<State, alphabet::Symbol>, State> InputDrivenDPDA::getTransiti
 		throw AutomatonException("State \"" + (std::string) to.getName() + "\" doesn't exist");
 
 	std::map<std::pair<State, alphabet::Symbol>, State> transitionsToState;
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& transition : transitions) {
 		if (transition.second == to) {
 			transitionsToState.insert(transition);
 		}
diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp b/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp
index 252db94103..478b716100 100644
--- a/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp
+++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.cpp
@@ -41,7 +41,7 @@ bool InputDrivenNPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
 		if (transition.first.first == state || transition.second.find(state) != transition.second.end())
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 	}
@@ -50,7 +50,7 @@ bool InputDrivenNPDA::removeState(const State& state) {
 }
 
 bool InputDrivenNPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
 		if (transition.first.second == symbol)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used.");
 	}
@@ -112,7 +112,7 @@ void InputDrivenNPDA::setPushdownStoreOperations(std::map<alphabet::Symbol, std:
 }
 
 bool InputDrivenNPDA::clearPushdownStoreOperation(const alphabet::Symbol& input) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
 		if (transition.first.second == input)
 			throw AutomatonException("Input symbol \"" + (std::string) input + "\" is used.");
 	}
@@ -157,7 +157,7 @@ std::map<std::pair<State, alphabet::Symbol>, std::set<State> > InputDrivenNPDA::
 		throw AutomatonException("State \"" + (std::string) from.getName() + "\" doesn't exist");
 
 	std::map<std::pair<State, alphabet::Symbol>, std::set<State> > transitionsFromState;
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
 		if (transition.first.first == from) {
 			transitionsFromState[transition.first].insert(transition.second.begin(), transition.second.end());
 		}
@@ -171,7 +171,7 @@ std::map<std::pair<State, alphabet::Symbol>, std::set<State> > InputDrivenNPDA::
 		throw AutomatonException("State \"" + (std::string) to.getName() + "\" doesn't exist");
 
 	std::map<std::pair<State, alphabet::Symbol>, std::set<State> > transitionsToState;
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
 		if (transition.second.find(to) != transition.second.end()) {
 			transitionsToState[transition.first].insert(transition.second.begin(), transition.second.end());
 		}
@@ -181,7 +181,7 @@ std::map<std::pair<State, alphabet::Symbol>, std::set<State> > InputDrivenNPDA::
 }
 
 bool InputDrivenNPDA::isDeterministic() const {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& transition : transitions) {
 		if (transition.second.size() != 1 || transition.second.size() != 0) {
 			return false;
 		}
diff --git a/alib2data/src/automaton/PDA/NPDA.cpp b/alib2data/src/automaton/PDA/NPDA.cpp
index ce3d3249dd..3b5f5449ea 100644
--- a/alib2data/src/automaton/PDA/NPDA.cpp
+++ b/alib2data/src/automaton/PDA/NPDA.cpp
@@ -41,7 +41,7 @@ bool NPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
 		if (state == std::get<0>(transition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const std::pair<State, std::vector<alphabet::Symbol> >& target : transition.second) {
@@ -54,7 +54,7 @@ bool NPDA::removeState(const State& state) {
 }
 
 bool NPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
 		if (std::get<1>(transition.first).is<alphabet::Symbol>() && symbol == std::get<1>(transition.first).get<alphabet::Symbol>())
 			throw AutomatonException("Symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -67,7 +67,7 @@ bool NPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
 		throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is start symbol.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
 		for (const alphabet::Symbol& popSymbol : std::get<2>(transition.first)) {
 			if (symbol == popSymbol)
 				throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp
index c87326c1c3..e89ad381a2 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.cpp
@@ -41,21 +41,21 @@ bool RealTimeHeightDeterministicDPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
 		if (state == callTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(callTransition.second.first == state)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
 		if (state == std::get<0>(returnTransition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(returnTransition.second == state)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, State>& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, State>& localTransition : localTransitions) {
 		if (state == localTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(localTransition.second == state)
@@ -66,17 +66,17 @@ bool RealTimeHeightDeterministicDPDA::removeState(const State& state) {
 }
 
 bool RealTimeHeightDeterministicDPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
 		if (callTransition.first.second.is<alphabet::Symbol>() && symbol == callTransition.first.second.get<alphabet::Symbol>())
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
 		if (std::get<1>(returnTransition.first).is<alphabet::Symbol>() && symbol == std::get<1>(returnTransition.first).get<alphabet::Symbol>())
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, State>& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, State>& localTransition : localTransitions) {
 		if (localTransition.first.second.is<alphabet::Symbol>() && symbol == localTransition.first.second.get<alphabet::Symbol>())
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -85,12 +85,12 @@ bool RealTimeHeightDeterministicDPDA::removeInputSymbol(const alphabet::Symbol&
 }
 
 bool RealTimeHeightDeterministicDPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
 		if (symbol == callTransition.second.second)
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
 		if (symbol == std::get<2>(returnTransition.first))
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp
index a8224926a7..7094310ddb 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.cpp
@@ -41,7 +41,7 @@ bool RealTimeHeightDeterministicNPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
 		if (state == callTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const std::pair<State, alphabet::Symbol>& target : callTransition.second) {
@@ -50,7 +50,7 @@ bool RealTimeHeightDeterministicNPDA::removeState(const State& state) {
 		}
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
 		if (state == std::get<0>(returnTransition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const State& target : returnTransition.second) {
@@ -59,7 +59,7 @@ bool RealTimeHeightDeterministicNPDA::removeState(const State& state) {
 		}
 	}
 
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<State> >& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<State> >& localTransition : localTransitions) {
 		if (state == localTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const State& target : localTransition.second) {
@@ -72,17 +72,17 @@ bool RealTimeHeightDeterministicNPDA::removeState(const State& state) {
 }
 
 bool RealTimeHeightDeterministicNPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
 		if (callTransition.first.second.is<alphabet::Symbol>() && symbol == callTransition.first.second.get<alphabet::Symbol>())
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
 		if (std::get<1>(returnTransition.first).is<alphabet::Symbol>() && symbol == std::get<1>(returnTransition.first).get<alphabet::Symbol>())
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<State> >& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<State> >& localTransition : localTransitions) {
 		if (localTransition.first.second.is<alphabet::Symbol>() && symbol == localTransition.first.second.get<alphabet::Symbol>())
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -91,14 +91,14 @@ bool RealTimeHeightDeterministicNPDA::removeInputSymbol(const alphabet::Symbol&
 }
 
 bool RealTimeHeightDeterministicNPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
 		for(const std::pair<State, alphabet::Symbol>& to : callTransition.second) {
 			if (symbol == to.second)
 				throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 		}
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
 		if (symbol == std::get<2>(returnTransition.first))
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.cpp b/alib2data/src/automaton/PDA/SinglePopDPDA.cpp
index 5b25192b27..377776e802 100644
--- a/alib2data/src/automaton/PDA/SinglePopDPDA.cpp
+++ b/alib2data/src/automaton/PDA/SinglePopDPDA.cpp
@@ -41,7 +41,7 @@ bool SinglePopDPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (state == std::get<0>(transition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(transition.second.first == state)
@@ -52,7 +52,7 @@ bool SinglePopDPDA::removeState(const State& state) {
 }
 
 bool SinglePopDPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (std::get<1>(transition.first).is<alphabet::Symbol>() && symbol == std::get<1>(transition.first).get<alphabet::Symbol>())
 			throw AutomatonException("Symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -61,7 +61,7 @@ bool SinglePopDPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool SinglePopDPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > >& transition : transitions) {
 		if (symbol == std::get<2>(transition.first))
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 
diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.cpp b/alib2data/src/automaton/PDA/SinglePopNPDA.cpp
index 69c2ad96cc..4e9e167eb4 100644
--- a/alib2data/src/automaton/PDA/SinglePopNPDA.cpp
+++ b/alib2data/src/automaton/PDA/SinglePopNPDA.cpp
@@ -40,7 +40,7 @@ bool SinglePopNPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
 		if (state == std::get<0>(transition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const std::pair<State, std::vector<alphabet::Symbol> >& target : transition.second) {
@@ -53,7 +53,7 @@ bool SinglePopNPDA::removeState(const State& state) {
 }
 
 bool SinglePopNPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
 		if (std::get<1>(transition.first).is<alphabet::Symbol>() && symbol == std::get<1>(transition.first).get<alphabet::Symbol>())
 			throw AutomatonException("Symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -66,7 +66,7 @@ bool SinglePopNPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
 		throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is start symbol.");
 	}
 
-	for (const std::pair<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
+	for (const std::pair<const std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > >& transition : transitions) {
 		if (symbol == std::get<2>(transition.first))
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 
@@ -121,7 +121,7 @@ bool SinglePopNPDA::addTransition(State from, alphabet::Symbol pop, State to, st
 bool SinglePopNPDA::removeTransition(const State& from, const std::variant<string::Epsilon, alphabet::Symbol>& input, const alphabet::Symbol& pop, const State& to, const std::vector<alphabet::Symbol>& push) {
 	std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol> key(from, input, pop);
 	std::pair<automaton::State, std::vector<alphabet::Symbol> > value = std::make_pair(to, push);
-	
+
 	return transitions[key].erase(value);
 }
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp
index 5bc11b7d4c..4061095b92 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.cpp
@@ -40,21 +40,21 @@ bool VisiblyPushdownDPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
 		if (state == callTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(callTransition.second.first == state)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
 		if (state == std::get<0>(returnTransition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(returnTransition.second == state)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& localTransition : localTransitions) {
 		if (state == localTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		if(localTransition.second == state)
@@ -65,17 +65,17 @@ bool VisiblyPushdownDPDA::removeState(const State& state) {
 }
 
 bool VisiblyPushdownDPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
 		if (symbol == callTransition.first.second)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
 		if (symbol == std::get<1>(returnTransition.first))
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, State>& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, State>& localTransition : localTransitions) {
 		if (symbol == localTransition.first.second)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -84,12 +84,12 @@ bool VisiblyPushdownDPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool VisiblyPushdownDPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> >& callTransition : callTransitions) {
 		if (symbol == callTransition.second.second)
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State>& returnTransition : returnTransitions) {
 		if (symbol == std::get<2>(returnTransition.first))
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp
index 947032c829..dd7bcb9be5 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.cpp
@@ -40,7 +40,7 @@ bool VisiblyPushdownNPDA::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
 		if (state == callTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const std::pair<State, alphabet::Symbol>& target : callTransition.second) {
@@ -49,7 +49,7 @@ bool VisiblyPushdownNPDA::removeState(const State& state) {
 		}
 	}
 
-	for (const std::pair<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
 		if (state == std::get<0>(returnTransition.first))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const State& target : returnTransition.second) {
@@ -58,7 +58,7 @@ bool VisiblyPushdownNPDA::removeState(const State& state) {
 		}
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& localTransition : localTransitions) {
 		if (state == localTransition.first.first)
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in transition.");
 		for(const State& target : localTransition.second) {
@@ -71,17 +71,17 @@ bool VisiblyPushdownNPDA::removeState(const State& state) {
 }
 
 bool VisiblyPushdownNPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
 		if (symbol == callTransition.first.second)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
 		if (symbol == std::get<1>(returnTransition.first))
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<State> >& localTransition : localTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<State> >& localTransition : localTransitions) {
 		if (symbol == localTransition.first.second)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
@@ -90,14 +90,14 @@ bool VisiblyPushdownNPDA::removeInputSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool VisiblyPushdownNPDA::removeStackSymbol(const alphabet::Symbol& symbol) {
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > >& callTransition : callTransitions) {
 		for(const std::pair<State, alphabet::Symbol>& to : callTransition.second) {
 			if (symbol == to.second)
 				throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 		}
 	}
 
-	for (const std::pair<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
+	for (const std::pair<const std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> >& returnTransition : returnTransitions) {
 		if (symbol == std::get<2>(returnTransition.first))
 			throw AutomatonException("Stack symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
diff --git a/alib2data/src/automaton/TA/DFTA.cpp b/alib2data/src/automaton/TA/DFTA.cpp
index a22ace81f3..91029cc875 100644
--- a/alib2data/src/automaton/TA/DFTA.cpp
+++ b/alib2data/src/automaton/TA/DFTA.cpp
@@ -37,7 +37,7 @@ bool DFTA::removeState(const State& state) {
 	}
 
 	AutomatonException ex ("State \"" + (std::string) state.getName() + "\" is used in transition.");
-	for (const std::pair<std::pair<alphabet::RankedSymbol, std::vector<State> >, State>& t : transitions) {
+	for (const std::pair<const std::pair<alphabet::RankedSymbol, std::vector<State> >, State>& t : transitions) {
 		const std::vector<State>& states = t . first.second;
 		for (const State& it : states) {
 			if (it == state) throw ex;
@@ -49,7 +49,7 @@ bool DFTA::removeState(const State& state) {
 }
 
 bool DFTA::removeInputSymbol(const alphabet::RankedSymbol& symbol) {
-	for (const std::pair<std::pair<alphabet::RankedSymbol, std::vector<State> >, State>& t : transitions) {
+	for (const std::pair<const std::pair<alphabet::RankedSymbol, std::vector<State> >, State>& t : transitions) {
 		if (t . first.first == symbol)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used.");
 	}
diff --git a/alib2data/src/automaton/TA/NFTA.cpp b/alib2data/src/automaton/TA/NFTA.cpp
index eaf4b4b6e6..6bc2a57280 100644
--- a/alib2data/src/automaton/TA/NFTA.cpp
+++ b/alib2data/src/automaton/TA/NFTA.cpp
@@ -46,7 +46,7 @@ bool NFTA::removeState(const State& state) {
 	}
 
 	AutomatonException ex ("State \"" + (std::string) state.getName() + "\" is used in transition.");
-	for (const std::pair<std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> >& t : transitions) {
+	for (const std::pair<const std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> >& t : transitions) {
 		const std::vector<State>& states = t . first.second;
 		for (const State& it : states) {
 			if (it == state) throw ex;
@@ -58,7 +58,7 @@ bool NFTA::removeState(const State& state) {
 }
 
 bool NFTA::removeInputSymbol(const alphabet::RankedSymbol& symbol) {
-	for (const std::pair<std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> >& t : transitions) {
+	for (const std::pair<const std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> >& t : transitions) {
 		if (t . first.first == symbol)
 			throw AutomatonException("Input symbol \"" + (std::string) symbol + "\" is used.");
 	}
@@ -92,7 +92,7 @@ bool NFTA::removeTransition(const alphabet::RankedSymbol symbol, const std::vect
 }
 
 bool NFTA::isDeterministic() const {
-	for (const std::pair<std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> >& t : transitions) {
+	for (const std::pair<const std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> >& t : transitions) {
 		if (t . second.size() != 1 || t . second.size() != 0) {
 			return false;
 		}
diff --git a/alib2data/src/automaton/TM/OneTapeDTM.cpp b/alib2data/src/automaton/TM/OneTapeDTM.cpp
index fe03a222c4..db775b2427 100644
--- a/alib2data/src/automaton/TM/OneTapeDTM.cpp
+++ b/alib2data/src/automaton/TM/OneTapeDTM.cpp
@@ -39,7 +39,7 @@ bool OneTapeDTM::removeState(const State& state) {
 		throw AutomatonException("State \"" + (std::string) state.getName() + "\" is final state.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& transition : transitions) {
 		if (state == transition.first.first || state == std::get<0>(transition.second))
 			throw AutomatonException("State \"" + (std::string) state.getName() + "\" is used in a transition.");
 	}
@@ -56,7 +56,7 @@ bool OneTapeDTM::removeTapeSymbol(const alphabet::Symbol& symbol) {
 		throw AutomatonException("Tape symbol \"" + (std::string) symbol + "\" is in input alphabet.");
 	}
 
-	for (const std::pair<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& transition : transitions) {
+	for (const std::pair<const std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> >& transition : transitions) {
 		if (symbol == transition.first.second || symbol == std::get<1>(transition.second))
 			throw AutomatonException("Tape symbol \"" + (std::string) symbol + "\" is used in transition.");
 	}
diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h
index ee35c546b7..7a07f24a4c 100644
--- a/alib2data/src/container/ObjectsMap.h
+++ b/alib2data/src/container/ObjectsMap.h
@@ -72,7 +72,7 @@ template < class T, class R >
 void ObjectsMap::compose ( std::deque < sax::Token > & out, const std::map < T, R > & input ) {
 	out.emplace_back ( ObjectsMap::XML_TAG_NAME, sax::Token::TokenType::START_ELEMENT );
 
-	for ( const std::pair < T, R > & item : input )
+	for ( const std::pair < const T, R > & item : input )
 		alib::xmlApi < std::pair < T, R > >::compose ( out, item );
 
 	out.emplace_back ( ObjectsMap::XML_TAG_NAME, sax::Token::TokenType::END_ELEMENT );
diff --git a/alib2data/src/grammar/ContextFree/CFG.cpp b/alib2data/src/grammar/ContextFree/CFG.cpp
index 182ee502b6..56f5330cf0 100644
--- a/alib2data/src/grammar/ContextFree/CFG.cpp
+++ b/alib2data/src/grammar/ContextFree/CFG.cpp
@@ -32,7 +32,7 @@ CFG::CFG(std::set<alphabet::Symbol> nonterminalAlphabet, std::set<alphabet::Symb
 }
 
 CFG::CFG( const EpsilonFreeCFG & other ) : CFG(other.getNonterminalAlphabet(), other.getTerminalAlphabet(), other.getInitialSymbol()) {
-	for(const std::pair<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> & rule : other.getRules() ) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> & rule : other.getRules() ) {
 		const alphabet::Symbol & lhs = rule.first;
 		for(const std::vector<alphabet::Symbol>& rhs : rule.second) {
 			addRule(lhs, rhs);
@@ -49,7 +49,7 @@ GrammarBase* CFG::plunder() && {
 }
 
 bool CFG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		for(const std::vector<alphabet::Symbol>& rhs : rule.second)
 			if(std::find(rhs.begin(), rhs.end(), symbol) != rhs.end())
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
@@ -59,7 +59,7 @@ bool CFG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool CFG::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		if(rule.first == symbol)
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2data/src/grammar/ContextFree/CNF.cpp b/alib2data/src/grammar/ContextFree/CNF.cpp
index ef3a78fbd6..b4f8c3f436 100644
--- a/alib2data/src/grammar/ContextFree/CNF.cpp
+++ b/alib2data/src/grammar/ContextFree/CNF.cpp
@@ -39,7 +39,7 @@ GrammarBase* CNF::plunder() && {
 }
 
 bool CNF::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::variant<alphabet::Symbol, std::pair<alphabet::Symbol, alphabet::Symbol>>>>& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::variant<alphabet::Symbol, std::pair<alphabet::Symbol, alphabet::Symbol>>>>& rule : rules) {
 		for(const std::variant<alphabet::Symbol, std::pair<alphabet::Symbol, alphabet::Symbol>>& rhs : rule.second) {
 			if((rhs.is<alphabet::Symbol>() && rhs.get<alphabet::Symbol>() == symbol) || (rhs.get<std::pair<alphabet::Symbol, alphabet::Symbol>>().first == symbol))
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
@@ -50,7 +50,7 @@ bool CNF::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool CNF::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::variant<alphabet::Symbol, std::pair<alphabet::Symbol, alphabet::Symbol>>>>& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::variant<alphabet::Symbol, std::pair<alphabet::Symbol, alphabet::Symbol>>>>& rule : rules) {
 		if(rule.first == symbol)
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp
index 3bdf501495..660810a694 100644
--- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp
+++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp
@@ -39,7 +39,7 @@ GrammarBase* EpsilonFreeCFG::plunder() && {
 }
 
 bool EpsilonFreeCFG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		for(const std::vector<alphabet::Symbol>& rhs : rule.second)
 			if(std::find(rhs.begin(), rhs.end(), symbol) != rhs.end())
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
@@ -49,7 +49,7 @@ bool EpsilonFreeCFG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool EpsilonFreeCFG::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		if(rule.first == symbol)
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2data/src/grammar/ContextFree/GNF.cpp b/alib2data/src/grammar/ContextFree/GNF.cpp
index f1d4562f07..046a08e22a 100644
--- a/alib2data/src/grammar/ContextFree/GNF.cpp
+++ b/alib2data/src/grammar/ContextFree/GNF.cpp
@@ -39,7 +39,7 @@ GrammarBase* GNF::plunder() && {
 }
 
 bool GNF::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::pair<alphabet::Symbol, std::vector<alphabet::Symbol> >> >& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::pair<alphabet::Symbol, std::vector<alphabet::Symbol> >> >& rule : rules) {
 		for(const std::pair<alphabet::Symbol, std::vector<alphabet::Symbol> >& rhs : rule.second)
 			if(rhs.first == symbol)
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
@@ -49,7 +49,7 @@ bool GNF::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool GNF::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::pair<alphabet::Symbol, std::vector<alphabet::Symbol> >> >& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::pair<alphabet::Symbol, std::vector<alphabet::Symbol> >> >& rule : rules) {
 		if(rule.first == symbol)
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2data/src/grammar/ContextFree/LG.cpp b/alib2data/src/grammar/ContextFree/LG.cpp
index 2a000a25d2..51d993156d 100644
--- a/alib2data/src/grammar/ContextFree/LG.cpp
+++ b/alib2data/src/grammar/ContextFree/LG.cpp
@@ -39,7 +39,7 @@ GrammarBase* LG::plunder() && {
 }
 
 bool LG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>> >> >& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>> >> >& rule : rules) {
 		for(const std::variant<std::vector<alphabet::Symbol>, std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>> >& rhsTmp : rule.second)
 			if(rhsTmp.is<std::vector<alphabet::Symbol>>()) {
 				const std::vector<alphabet::Symbol>& rhs = rhsTmp.get<std::vector<alphabet::Symbol>>();
@@ -63,7 +63,7 @@ bool LG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool LG::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>> >> >& rule : rules) {
+	for(const std::pair<const alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>> >> >& rule : rules) {
 		if(rule.first == symbol)
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2data/src/grammar/ContextSensitive/CSG.cpp b/alib2data/src/grammar/ContextSensitive/CSG.cpp
index 4df47db8e5..96755b20f8 100644
--- a/alib2data/src/grammar/ContextSensitive/CSG.cpp
+++ b/alib2data/src/grammar/ContextSensitive/CSG.cpp
@@ -39,7 +39,7 @@ GrammarBase* CSG::plunder() && {
 }
 
 bool CSG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		for(const alphabet::Symbol& lCont : std::get<0>(rule.first))
 			if(lCont == symbol)
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
@@ -57,7 +57,7 @@ bool CSG::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool CSG::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		for(const alphabet::Symbol& lCont : std::get<0>(rule.first))
 			if(lCont == symbol)
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp
index 073124593e..f5bd683996 100644
--- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp
+++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp
@@ -39,7 +39,7 @@ GrammarBase* NonContractingGrammar::plunder() && {
 }
 
 bool NonContractingGrammar::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		if(std::find(rule.first.begin(), rule.first.end(), symbol) != rule.first.end())
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
@@ -52,7 +52,7 @@ bool NonContractingGrammar::removeTerminalSymbol(const alphabet::Symbol& symbol)
 }
 
 bool NonContractingGrammar::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		if(std::find(rule.first.begin(), rule.first.end(), symbol) != rule.first.end())
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp
index 1cd8fdb7cf..a2c1494748 100644
--- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp
+++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp
@@ -39,7 +39,7 @@ GrammarBase* ContextPreservingUnrestrictedGrammar::plunder() && {
 }
 
 bool ContextPreservingUnrestrictedGrammar::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		for(const alphabet::Symbol& lCont : std::get<0>(rule.first))
 			if(lCont == symbol)
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
@@ -57,7 +57,7 @@ bool ContextPreservingUnrestrictedGrammar::removeTerminalSymbol(const alphabet::
 }
 
 bool ContextPreservingUnrestrictedGrammar::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		for(const alphabet::Symbol& lCont : std::get<0>(rule.first))
 			if(lCont == symbol)
 				throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp
index 93230a838a..3cbb6f22bc 100644
--- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp
+++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp
@@ -39,7 +39,7 @@ GrammarBase* UnrestrictedGrammar::plunder() && {
 }
 
 bool UnrestrictedGrammar::removeTerminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		if(std::find(rule.first.begin(), rule.first.end(), symbol) != rule.first.end())
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
@@ -52,7 +52,7 @@ bool UnrestrictedGrammar::removeTerminalSymbol(const alphabet::Symbol& symbol) {
 }
 
 bool UnrestrictedGrammar::removeNonterminalSymbol(const alphabet::Symbol& symbol) {
-	for(const std::pair<std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
+	for(const std::pair<const std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>>& rule : rules) {
 		if(std::find(rule.first.begin(), rule.first.end(), symbol) != rule.first.end())
 			throw GrammarException("Symbol \"" + (std::string) symbol + "\" is used in rule.");
 
diff --git a/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp b/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp
index 4de5f43716..59505d9686 100644
--- a/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp
+++ b/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp
@@ -106,7 +106,7 @@ std::map<automaton::State, std::set<automaton::State>> AllEpsilonClosure::allEps
 	std::set<automaton::State> nonvisited = fsm.getStates();
 
 	std::map<automaton::State, std::set<automaton::State>> epsilonTransitions;
-	for(const std::pair<std::pair<State, regexp::RegExp>, std::set<State> >& transition : fsm.getTransitions() )
+	for(const std::pair<const std::pair<State, regexp::RegExp>, std::set<State> >& transition : fsm.getTransitions() )
 		if( regexp::properties::RegExpEpsilon::languageContainsEpsilon( transition.first.second ) )
 			epsilonTransitions[transition.first.first].insert(transition.second.begin(), transition.second.end());
 
@@ -135,7 +135,7 @@ std::map<automaton::State, std::set<automaton::State>> AllEpsilonClosure::allEps
 	std::set<automaton::State> nonvisited = fsm.getStates();
 
 	std::map<automaton::State, std::set<automaton::State>> epsilonTransitions;
-	for(const std::pair<std::pair<State, string::LinearString>, std::set<State> >& transition : fsm.getTransitions() )
+	for(const std::pair<const std::pair<State, string::LinearString>, std::set<State> >& transition : fsm.getTransitions() )
 		if( transition.first.second.getContent().size() == 0 )
 			epsilonTransitions[transition.first.first].insert(transition.second.begin(), transition.second.end());
 
diff --git a/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.cpp b/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.cpp
index a40bc52d51..c5f4ca5963 100644
--- a/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.cpp
+++ b/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.cpp
@@ -46,7 +46,7 @@ automaton::MultiInitialStateNFA EpsilonRemoverOutgoing::remove( const automaton:
 
 	std::map<std::pair<automaton::State, alphabet::Symbol>, std::set<automaton::State>> transitions = origFSM.getSymbolTransitions();
 
-	for(const std::pair<std::pair<automaton::State, alphabet::Symbol>, std::set<automaton::State>>& transition : transitions)
+	for(const std::pair<const std::pair<automaton::State, alphabet::Symbol>, std::set<automaton::State>>& transition : transitions)
 		for(const automaton::State& to : transition.second)
 			for(const automaton::State& toClosure : closures[to])
 				fsm.addTransition(transition.first.first, transition.first.second, toClosure);
diff --git a/alib2measurepp/src/provisioner/MeasurementProvisionerResultsXml.cpp b/alib2measurepp/src/provisioner/MeasurementProvisionerResultsXml.cpp
index ad26e990c6..f0bf9c1146 100644
--- a/alib2measurepp/src/provisioner/MeasurementProvisionerResultsXml.cpp
+++ b/alib2measurepp/src/provisioner/MeasurementProvisionerResultsXml.cpp
@@ -36,7 +36,7 @@ void MeasurementProvisionerResultsXml::composeMeasurementProvisionerResult ( deq
 void MeasurementProvisionerResultsXml::composeInputs ( deque < Token > & tokens, const MPRInputResult & mprir ) {
 	tokens.emplace_back ( INPUTS_TAG, Token::TokenType::START_ELEMENT );
 
-	for ( const std::pair < int, std::string > & input : mprir.inputs ) {
+	for ( const std::pair < const int, std::string > & input : mprir.inputs ) {
 		tokens.emplace_back ( INPUT_TAG, Token::TokenType::START_ELEMENT );
 		tokens.emplace_back ( INPUT_ATTR_ID_NAME, Token::TokenType::START_ATTRIBUTE );
 		tokens.emplace_back ( std::to_string ( input.first ), Token::TokenType::CHARACTER );
diff --git a/alib2std/src/extensions/map.hpp b/alib2std/src/extensions/map.hpp
index 6113320317..1d8bb3219e 100644
--- a/alib2std/src/extensions/map.hpp
+++ b/alib2std/src/extensions/map.hpp
@@ -17,7 +17,7 @@ std::ostream& operator<<(std::ostream& out, const std::map<T, R>& map) {
 	out << "{";
 
 	bool first = true;
-	for(const std::pair<T, R>& item : map) {
+	for(const std::pair<const T, R>& item : map) {
 		if(!first) out << ", ";
 		first = false;
 		out << item;
diff --git a/alib2std/src/extensions/unordered_map.hpp b/alib2std/src/extensions/unordered_map.hpp
index 2413ef446d..9c075beb57 100644
--- a/alib2std/src/extensions/unordered_map.hpp
+++ b/alib2std/src/extensions/unordered_map.hpp
@@ -15,7 +15,7 @@ std::ostream& operator<<(std::ostream& out, const std::unordered_map<T, R>& map)
 	out << "{";
 
 	bool first = true;
-	for(const std::pair<T, R>& item : map) {
+	for(const std::pair<const T, R>& item : map) {
 		if(!first) out << ", ";
 		first = false;
 		out << item;
-- 
GitLab