From 57d07aabe69bdfe6a3bc509783927c936bbe02d3 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Tue, 12 May 2015 08:05:31 +0200
Subject: [PATCH] make alib2data compilant with llvm

---
 alib2data/src/XmlApi.hpp                               |  4 ++++
 alib2data/src/alphabet/BarSymbol.h                     |  2 +-
 alib2data/src/alphabet/BlankSymbol.h                   |  2 +-
 alib2data/src/alphabet/BottomOfTheStackSymbol.h        |  2 +-
 alib2data/src/alphabet/EndSymbol.h                     |  2 +-
 alib2data/src/alphabet/LabeledSymbol.h                 |  2 +-
 alib2data/src/alphabet/RankedBarSymbol.h               |  2 +-
 alib2data/src/alphabet/RankedSymbol.h                  |  2 +-
 alib2data/src/alphabet/StartSymbol.h                   |  2 +-
 alib2data/src/alphabet/SubtreeWildcardSymbol.h         |  2 +-
 alib2data/src/alphabet/SymbolFromStringParser.h        |  6 +++++-
 alib2data/src/alphabet/SymbolFromXMLParser.h           |  6 +++++-
 alib2data/src/alphabet/SymbolPairSymbol.h              |  2 +-
 alib2data/src/alphabet/SymbolSetSymbol.h               |  2 +-
 alib2data/src/alphabet/SymbolToStringComposer.h        |  4 ++++
 alib2data/src/alphabet/SymbolToXMLComposer.h           |  6 +++++-
 alib2data/src/alphabet/UniqueSymbol.h                  |  2 +-
 alib2data/src/automaton/AutomatonBase.h                |  8 ++++++++
 alib2data/src/automaton/AutomatonFromStringParser.h    |  6 +++++-
 alib2data/src/automaton/AutomatonFromXMLParser.h       |  6 +++++-
 alib2data/src/automaton/AutomatonToStringComposer.h    |  4 ++++
 alib2data/src/automaton/AutomatonToXMLComposer.h       |  6 +++++-
 alib2data/src/automaton/FSM/CompactNFA.h               |  2 +-
 alib2data/src/automaton/FSM/DFA.h                      |  2 +-
 alib2data/src/automaton/FSM/EpsilonNFA.h               |  2 +-
 alib2data/src/automaton/FSM/ExtendedNFA.h              |  2 +-
 alib2data/src/automaton/FSM/MultiInitialStateNFA.h     |  2 +-
 alib2data/src/automaton/FSM/NFA.h                      |  2 +-
 alib2data/src/automaton/PDA/DPDA.h                     |  2 +-
 alib2data/src/automaton/PDA/InputDrivenDPDA.h          |  2 +-
 alib2data/src/automaton/PDA/InputDrivenNPDA.h          |  2 +-
 alib2data/src/automaton/PDA/NPDA.h                     |  2 +-
 .../automaton/PDA/RealTimeHeightDeterministicDPDA.h    |  2 +-
 .../automaton/PDA/RealTimeHeightDeterministicNPDA.h    |  2 +-
 alib2data/src/automaton/PDA/SinglePopDPDA.h            |  2 +-
 alib2data/src/automaton/PDA/SinglePopNPDA.h            |  2 +-
 alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h      |  2 +-
 alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h      |  2 +-
 alib2data/src/automaton/TA/DFTA.h                      |  2 +-
 alib2data/src/automaton/TA/NFTA.h                      |  2 +-
 alib2data/src/automaton/TM/OneTapeDTM.h                |  2 +-
 alib2data/src/common/base.hpp                          | 10 ++++++++++
 alib2data/src/common/visitor.hpp                       |  7 +++++--
 alib2data/src/container/ContainerFromXMLParser.hpp     |  6 +++++-
 alib2data/src/container/ContainerToXMLComposer.hpp     |  6 +++++-
 alib2data/src/container/ObjectsMap.h                   |  2 +-
 alib2data/src/container/ObjectsPair.h                  |  2 +-
 alib2data/src/container/ObjectsSet.h                   |  2 +-
 alib2data/src/container/ObjectsVector.h                |  2 +-
 alib2data/src/exception/AlibException.h                |  2 +-
 alib2data/src/exception/ExceptionFromXMLParser.h       |  6 +++++-
 alib2data/src/exception/ExceptionToXMLComposer.h       |  6 +++++-
 alib2data/src/grammar/ContextFree/CFG.h                |  2 +-
 alib2data/src/grammar/ContextFree/CNF.h                |  2 +-
 alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h     |  2 +-
 alib2data/src/grammar/ContextFree/GNF.h                |  2 +-
 alib2data/src/grammar/ContextFree/LG.h                 |  2 +-
 alib2data/src/grammar/ContextSensitive/CSG.h           |  2 +-
 .../grammar/ContextSensitive/NonContractingGrammar.h   |  2 +-
 alib2data/src/grammar/GrammarBase.h                    |  2 ++
 alib2data/src/grammar/GrammarFromStringParser.h        |  6 +++++-
 alib2data/src/grammar/GrammarFromXMLParser.h           |  6 +++++-
 alib2data/src/grammar/GrammarToStringComposer.h        |  4 ++++
 alib2data/src/grammar/GrammarToXMLComposer.h           |  6 +++++-
 alib2data/src/grammar/Regular/LeftLG.h                 |  2 +-
 alib2data/src/grammar/Regular/LeftRG.h                 |  2 +-
 alib2data/src/grammar/Regular/RightLG.h                |  2 +-
 alib2data/src/grammar/Regular/RightRG.h                |  2 +-
 .../ContextPreservingUnrestrictedGrammar.h             |  2 +-
 .../src/grammar/Unrestricted/UnrestrictedGrammar.h     |  2 +-
 alib2data/src/graph/GraphFromStringParser.h            |  5 ++++-
 alib2data/src/graph/GraphFromXMLParser.h               |  3 ++-
 alib2data/src/graph/GraphToStringComposer.h            |  2 ++
 alib2data/src/graph/GraphToXMLComposer.h               |  5 ++++-
 alib2data/src/graph/directed/DirectedEdge.h            |  2 +-
 alib2data/src/graph/directed/DirectedGraph.h           |  2 +-
 alib2data/src/graph/undirected/UndirectedEdge.h        |  2 +-
 alib2data/src/graph/undirected/UndirectedGraph.h       |  2 +-
 alib2data/src/label/HexavigesimalLabel.h               |  2 +-
 alib2data/src/label/LabelFromStringParser.h            |  6 +++++-
 alib2data/src/label/LabelFromXMLParser.h               |  6 +++++-
 alib2data/src/label/LabelPairLabel.h                   |  2 +-
 alib2data/src/label/LabelSetLabel.h                    |  2 +-
 alib2data/src/label/LabelToStringComposer.h            |  4 ++++
 alib2data/src/label/LabelToXMLComposer.h               |  6 +++++-
 alib2data/src/label/ObjectLabel.h                      |  2 +-
 alib2data/src/label/PrimitiveLabel.h                   |  2 +-
 alib2data/src/label/UniqueLabel.h                      |  2 +-
 alib2data/src/object/ObjectFromXMLParser.h             |  6 +++++-
 alib2data/src/object/ObjectToXMLComposer.h             |  6 +++++-
 alib2data/src/object/Void.h                            |  2 +-
 alib2data/src/primitive/Bool.h                         |  2 +-
 alib2data/src/primitive/Character.h                    |  2 +-
 alib2data/src/primitive/Integer.h                      |  2 +-
 alib2data/src/primitive/PrimitiveFromStringParser.h    |  6 +++++-
 alib2data/src/primitive/PrimitiveFromXMLParser.h       |  6 +++++-
 alib2data/src/primitive/PrimitiveToStringComposer.h    |  4 ++++
 alib2data/src/primitive/PrimitiveToXMLComposer.h       |  5 ++++-
 alib2data/src/primitive/String.h                       |  2 +-
 alib2data/src/primitive/Unsigned.h                     |  2 +-
 alib2data/src/regexp/RegExpAlphabetGetter.h            |  2 ++
 alib2data/src/regexp/RegExpFromStringParser.h          |  6 +++++-
 alib2data/src/regexp/RegExpFromXMLParser.h             |  6 +++++-
 alib2data/src/regexp/RegExpToStringComposer.h          |  4 ++++
 alib2data/src/regexp/RegExpToXMLComposer.h             |  6 +++++-
 alib2data/src/regexp/formal/FormalRegExp.h             |  2 +-
 alib2data/src/regexp/formal/FormalRegExpAlternation.h  |  2 +-
 .../src/regexp/formal/FormalRegExpConcatenation.h      |  2 +-
 alib2data/src/regexp/formal/FormalRegExpEmpty.h        |  2 +-
 alib2data/src/regexp/formal/FormalRegExpEpsilon.h      |  2 +-
 alib2data/src/regexp/formal/FormalRegExpIteration.h    |  2 +-
 alib2data/src/regexp/formal/FormalRegExpSymbol.h       |  2 +-
 alib2data/src/regexp/unbounded/UnboundedRegExp.h       |  2 +-
 .../src/regexp/unbounded/UnboundedRegExpAlternation.h  |  2 +-
 .../regexp/unbounded/UnboundedRegExpConcatenation.h    |  2 +-
 alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h  |  2 +-
 .../src/regexp/unbounded/UnboundedRegExpEpsilon.h      |  2 +-
 .../src/regexp/unbounded/UnboundedRegExpIteration.h    |  2 +-
 alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h |  2 +-
 alib2data/src/string/CyclicString.cpp                  |  4 ++--
 alib2data/src/string/CyclicString.h                    |  2 +-
 alib2data/src/string/Epsilon.cpp                       |  4 ++--
 alib2data/src/string/Epsilon.h                         |  2 +-
 alib2data/src/string/LinearString.cpp                  |  4 ++--
 alib2data/src/string/LinearString.h                    |  2 +-
 alib2data/src/string/StringAlphabetGetter.h            |  2 ++
 alib2data/src/string/StringFromStringParser.h          |  6 +++++-
 alib2data/src/string/StringFromXMLParser.h             |  6 +++++-
 alib2data/src/string/StringToStringComposer.h          |  4 ++++
 alib2data/src/string/StringToXMLComposer.h             |  6 +++++-
 alib2data/src/tree/RankedTree/RankedTree.h             |  2 +-
 alib2data/src/tree/TreeFromXMLParser.h                 |  5 ++++-
 alib2data/src/tree/TreeToXMLComposer.h                 |  5 ++++-
 alib2data/src/tree/UnrankedTree/UnrankedTree.h         |  2 +-
 alib2data/test-src/automaton/AutomatonTest.cpp         |  2 +-
 alib2data/test-src/common/VisitorTest.cpp              |  6 +++---
 136 files changed, 309 insertions(+), 128 deletions(-)

diff --git a/alib2data/src/XmlApi.hpp b/alib2data/src/XmlApi.hpp
index cf32f8ff9c..a4f7c9772d 100644
--- a/alib2data/src/XmlApi.hpp
+++ b/alib2data/src/XmlApi.hpp
@@ -807,6 +807,10 @@ public:
 };
 
 class ToXMLComposers : public VisitableObjectBase::const_visitor_type {
+public:
+	ToXMLComposers() {}
+
+private:
 	void Visit(void*, const Void& voidObject) const;
 
 	void Visit(void*, const exception::AlibException& symbol) const;
diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h
index 9b928307da..11cae0120c 100644
--- a/alib2data/src/alphabet/BarSymbol.h
+++ b/alib2data/src/alphabet/BarSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<BarSymbol>();
+		return typeId(*this);
 	}
 
 	static BarSymbol BAR;
diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h
index 818eee2cfb..f404638d51 100644
--- a/alib2data/src/alphabet/BlankSymbol.h
+++ b/alib2data/src/alphabet/BlankSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<BlankSymbol>();
+		return typeId(*this);
 	}
 
 	static BlankSymbol BLANK;
diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h
index 61c93e15d8..187781882f 100644
--- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h
+++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<BottomOfTheStackSymbol>();
+		return typeId(*this);
 	}
 
 	static BottomOfTheStackSymbol BOTTOM_OF_THE_STACK;
diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h
index e2edbd994f..c71c829f1a 100644
--- a/alib2data/src/alphabet/EndSymbol.h
+++ b/alib2data/src/alphabet/EndSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<EndSymbol>();
+		return typeId(*this);
 	}
 
 	static EndSymbol END;
diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h
index 7a60729ea4..9a3b07c2be 100644
--- a/alib2data/src/alphabet/LabeledSymbol.h
+++ b/alib2data/src/alphabet/LabeledSymbol.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LabeledSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/RankedBarSymbol.h b/alib2data/src/alphabet/RankedBarSymbol.h
index 82a5360125..923fc5280b 100644
--- a/alib2data/src/alphabet/RankedBarSymbol.h
+++ b/alib2data/src/alphabet/RankedBarSymbol.h
@@ -45,7 +45,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RankedBarSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h
index 96ab7921a6..93f91d3893 100644
--- a/alib2data/src/alphabet/RankedSymbol.h
+++ b/alib2data/src/alphabet/RankedSymbol.h
@@ -59,7 +59,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RankedSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/StartSymbol.h b/alib2data/src/alphabet/StartSymbol.h
index b22b5bd13e..09a7d8e1cf 100644
--- a/alib2data/src/alphabet/StartSymbol.h
+++ b/alib2data/src/alphabet/StartSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<StartSymbol>();
+		return typeId(*this);
 	}
 
 	static StartSymbol START;
diff --git a/alib2data/src/alphabet/SubtreeWildcardSymbol.h b/alib2data/src/alphabet/SubtreeWildcardSymbol.h
index a8facf57ee..fb2094334e 100644
--- a/alib2data/src/alphabet/SubtreeWildcardSymbol.h
+++ b/alib2data/src/alphabet/SubtreeWildcardSymbol.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<SubtreeWildcardSymbol>();
+		return typeId(*this);
 	}
 
 	static SubtreeWildcardSymbol SUBTREE_WILDCARD;
diff --git a/alib2data/src/alphabet/SymbolFromStringParser.h b/alib2data/src/alphabet/SymbolFromStringParser.h
index 32d9c65530..5d467712a1 100644
--- a/alib2data/src/alphabet/SymbolFromStringParser.h
+++ b/alib2data/src/alphabet/SymbolFromStringParser.h
@@ -22,12 +22,16 @@ struct stringApi;
 namespace alphabet {
 
 class SymbolFromStringParser {
+public:
+	SymbolFromStringParser() {};
+
+private:
 	SymbolFromStringLexer m_SymbolLexer;
 
 	Symbol parseSymbol(std::istream&, const std::set<FEATURES>& features) const;
 	Symbol parseSymbol(std::istream&) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace alphabet */
diff --git a/alib2data/src/alphabet/SymbolFromXMLParser.h b/alib2data/src/alphabet/SymbolFromXMLParser.h
index 71c2811736..9a8ac474f0 100644
--- a/alib2data/src/alphabet/SymbolFromXMLParser.h
+++ b/alib2data/src/alphabet/SymbolFromXMLParser.h
@@ -42,6 +42,10 @@ namespace alphabet {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class SymbolFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	SymbolFromXMLParser() {}
+
+private:
 	Symbol parseSymbol(std::deque<sax::Token>& input) const;
 	Symbol parseSymbol(std::deque<sax::Token>& input, const std::set<FEATURES>& features) const;
 
@@ -58,7 +62,7 @@ class SymbolFromXMLParser : public sax::FromXMLParserHelper {
 	SymbolSetSymbol parseSymbolSetSymbol(std::deque<sax::Token>& input) const;
 	UniqueSymbol parseUniqueSymbol(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/alphabet/SymbolPairSymbol.h b/alib2data/src/alphabet/SymbolPairSymbol.h
index b44583e9a3..c0f2fa411b 100644
--- a/alib2data/src/alphabet/SymbolPairSymbol.h
+++ b/alib2data/src/alphabet/SymbolPairSymbol.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<SymbolPairSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/SymbolSetSymbol.h b/alib2data/src/alphabet/SymbolSetSymbol.h
index bf13997816..70286e2363 100644
--- a/alib2data/src/alphabet/SymbolSetSymbol.h
+++ b/alib2data/src/alphabet/SymbolSetSymbol.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<SymbolSetSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/alphabet/SymbolToStringComposer.h b/alib2data/src/alphabet/SymbolToStringComposer.h
index d4e652f6cf..aee929cc76 100644
--- a/alib2data/src/alphabet/SymbolToStringComposer.h
+++ b/alib2data/src/alphabet/SymbolToStringComposer.h
@@ -17,6 +17,10 @@ namespace alphabet {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class SymbolToStringComposer : public VisitableSymbolBase::const_visitor_type {
+public:
+	SymbolToStringComposer() {}
+
+private:
 	void Visit(void*, const LabeledSymbol& symbol) const;
 	void Visit(void*, const BlankSymbol& symbol) const;
 	void Visit(void*, const BottomOfTheStackSymbol& symbol) const;
diff --git a/alib2data/src/alphabet/SymbolToXMLComposer.h b/alib2data/src/alphabet/SymbolToXMLComposer.h
index 6b9540369b..c896fc9ad5 100644
--- a/alib2data/src/alphabet/SymbolToXMLComposer.h
+++ b/alib2data/src/alphabet/SymbolToXMLComposer.h
@@ -26,6 +26,10 @@ namespace alphabet {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class SymbolToXMLComposer {
+public:
+	SymbolToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of UnknownAutomaton to the output stream.
 	 * @param automaton automaton to print
@@ -53,7 +57,7 @@ class SymbolToXMLComposer {
 	void compose(std::deque<sax::Token>& output, const SymbolSetSymbol& symbol) const;
 	void compose(std::deque<sax::Token>& output, const UniqueSymbol& symbol) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace alphabet */
diff --git a/alib2data/src/alphabet/UniqueSymbol.h b/alib2data/src/alphabet/UniqueSymbol.h
index 6c33af0d47..cde8d22c08 100644
--- a/alib2data/src/alphabet/UniqueSymbol.h
+++ b/alib2data/src/alphabet/UniqueSymbol.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<UniqueSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/AutomatonBase.h b/alib2data/src/automaton/AutomatonBase.h
index 0a36d3dcd3..6ce99dfa05 100644
--- a/alib2data/src/automaton/AutomatonBase.h
+++ b/alib2data/src/automaton/AutomatonBase.h
@@ -34,6 +34,8 @@ public:
 
 class VisitableConstFSMBase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const NFTA&) const {
 		throw exception::AlibException("Unsupported automaton type NFTA");
 	}
@@ -89,6 +91,8 @@ class VisitableConstFSMBase : public VisitableAutomatonBase::const_visitor_type
 
 class VisitableConstPDABase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const NFTA&) const {
 		throw exception::AlibException("Unsupported automaton type NFTA");
 	}
@@ -129,6 +133,8 @@ class VisitableConstPDABase : public VisitableAutomatonBase::const_visitor_type
 
 class VisitableConstNondeterministicAutomatonBase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const DFTA&) const {
 		throw exception::AlibException("Unsupported automaton type DFTA");
 	}
@@ -164,6 +170,8 @@ class VisitableConstNondeterministicAutomatonBase : public VisitableAutomatonBas
 
 class VisitableConstDeterministicAutomatonBase : public VisitableAutomatonBase::const_visitor_type {
 
+	using VisitableAutomatonBase::const_visitor_type::Visit;
+
 	void Visit(void*, const NFTA&) const {
 		throw exception::AlibException("Unsupported automaton type NFTA");
 	}
diff --git a/alib2data/src/automaton/AutomatonFromStringParser.h b/alib2data/src/automaton/AutomatonFromStringParser.h
index 640b1b7dee..a58e5a913b 100644
--- a/alib2data/src/automaton/AutomatonFromStringParser.h
+++ b/alib2data/src/automaton/AutomatonFromStringParser.h
@@ -28,6 +28,10 @@ struct stringApi;
 namespace automaton {
 
 class AutomatonFromStringParser {
+public:
+	AutomatonFromStringParser() {}
+
+private:
 	AutomatonFromStringLexer m_AutomatonLexer;
 
 	void initialFinalState(std::istream& input, bool& initial, bool& final) const;
@@ -45,7 +49,7 @@ class AutomatonFromStringParser {
 	MultiInitialStateNFA parseMultiInitialStateNFA(std::istream& input) const;
 	DFA parseDFA(std::istream& input) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/AutomatonFromXMLParser.h b/alib2data/src/automaton/AutomatonFromXMLParser.h
index 21eb262110..003f0ed408 100644
--- a/alib2data/src/automaton/AutomatonFromXMLParser.h
+++ b/alib2data/src/automaton/AutomatonFromXMLParser.h
@@ -49,6 +49,10 @@ namespace automaton {
  * Parser used to get general FSM or EpsilonNFA, NFA, DFA from XML parsed into deque of Tokens.
  */
 class AutomatonFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	AutomatonFromXMLParser() {}
+
+private:
 	std::set<State> parseStates(std::deque<sax::Token> &input) const;
 	State parseState(std::deque<sax::Token> &input) const;
 	std::set<alphabet::Symbol> parseInputAlphabet(std::deque<sax::Token> &input) const;
@@ -137,7 +141,7 @@ class AutomatonFromXMLParser : public sax::FromXMLParserHelper {
 	DFTA parseDFTA(std::deque<sax::Token>& input) const;
 	NFTA parseNFTA(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/automaton/AutomatonToStringComposer.h b/alib2data/src/automaton/AutomatonToStringComposer.h
index cadab745f0..ef21995297 100644
--- a/alib2data/src/automaton/AutomatonToStringComposer.h
+++ b/alib2data/src/automaton/AutomatonToStringComposer.h
@@ -18,6 +18,10 @@
 namespace automaton {
 
 class AutomatonToStringComposer : public VisitableAutomatonBase::const_visitor_type {
+public:
+	AutomatonToStringComposer() {}
+
+private:
 	void Visit(void*, const EpsilonNFA& automaton) const;
 	void Visit(void*, const MultiInitialStateNFA& automaton) const;
 	void Visit(void*, const NFA& automaton) const;
diff --git a/alib2data/src/automaton/AutomatonToXMLComposer.h b/alib2data/src/automaton/AutomatonToXMLComposer.h
index 03a15f46d2..a3f94727dc 100644
--- a/alib2data/src/automaton/AutomatonToXMLComposer.h
+++ b/alib2data/src/automaton/AutomatonToXMLComposer.h
@@ -42,6 +42,10 @@ namespace automaton {
  * This class contains methods to print XML representation of automata to the output stream.
  */
 class AutomatonToXMLComposer {
+public:
+	AutomatonToXMLComposer() {}
+
+private:
 	void composeStates(std::deque<sax::Token>&, const std::set<State>& states) const;
 	void composeInputAlphabet(std::deque<sax::Token>&, const std::set<alphabet::Symbol>& symbols) const;
 	void composeCallInputAlphabet(std::deque<sax::Token>&, const std::set<alphabet::Symbol>& symbols) const;
@@ -127,7 +131,7 @@ class AutomatonToXMLComposer {
 
 	void compose(std::deque<sax::Token>& output, const State& state) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h
index bd75605261..3a27e1b608 100644
--- a/alib2data/src/automaton/FSM/CompactNFA.h
+++ b/alib2data/src/automaton/FSM/CompactNFA.h
@@ -90,7 +90,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<CompactNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h
index b50399469b..c5aeac09d9 100644
--- a/alib2data/src/automaton/FSM/DFA.h
+++ b/alib2data/src/automaton/FSM/DFA.h
@@ -91,7 +91,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<DFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h
index ff1c13f705..4bac990280 100644
--- a/alib2data/src/automaton/FSM/EpsilonNFA.h
+++ b/alib2data/src/automaton/FSM/EpsilonNFA.h
@@ -169,7 +169,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<EpsilonNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h
index 4ef3b58657..0d13ae8515 100644
--- a/alib2data/src/automaton/FSM/ExtendedNFA.h
+++ b/alib2data/src/automaton/FSM/ExtendedNFA.h
@@ -92,7 +92,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ExtendedNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
index ee1a836d2a..ea47281486 100644
--- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
+++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
@@ -107,7 +107,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<MultiInitialStateNFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h
index 878b3ae068..4b7c672e5f 100644
--- a/alib2data/src/automaton/FSM/NFA.h
+++ b/alib2data/src/automaton/FSM/NFA.h
@@ -105,7 +105,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<NFA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h
index c160cb4829..3c6d674e9a 100644
--- a/alib2data/src/automaton/PDA/DPDA.h
+++ b/alib2data/src/automaton/PDA/DPDA.h
@@ -102,7 +102,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<DPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.h b/alib2data/src/automaton/PDA/InputDrivenDPDA.h
index b256d93128..4e732890a7 100644
--- a/alib2data/src/automaton/PDA/InputDrivenDPDA.h
+++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.h
@@ -104,7 +104,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<InputDrivenDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h
index a7ad529c2b..4a0617f31c 100644
--- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h
+++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h
@@ -103,7 +103,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<InputDrivenNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h
index e5ff3ec5e1..8f970a31bd 100644
--- a/alib2data/src/automaton/PDA/NPDA.h
+++ b/alib2data/src/automaton/PDA/NPDA.h
@@ -88,7 +88,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<NPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
index 63aa389073..99b582e569 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
@@ -128,7 +128,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<RealTimeHeightDeterministicDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
index e1c6a23886..6d37544cf5 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
@@ -128,7 +128,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<RealTimeHeightDeterministicNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h
index b14fb3f948..270d2d790f 100644
--- a/alib2data/src/automaton/PDA/SinglePopDPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h
@@ -92,7 +92,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<SinglePopDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h
index 8284bf1c14..95a14e59fa 100644
--- a/alib2data/src/automaton/PDA/SinglePopNPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h
@@ -88,7 +88,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<SinglePopNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
index 516f5305a1..8c19fa18ea 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
@@ -114,7 +114,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<VisiblyPushdownDPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
index 9b3cb34b67..2e1a9c40dd 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
@@ -114,7 +114,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<VisiblyPushdownNPDA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/TA/DFTA.h b/alib2data/src/automaton/TA/DFTA.h
index aa1a656778..a200a08cb8 100644
--- a/alib2data/src/automaton/TA/DFTA.h
+++ b/alib2data/src/automaton/TA/DFTA.h
@@ -83,7 +83,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<DFTA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/TA/NFTA.h b/alib2data/src/automaton/TA/NFTA.h
index 95aa597b88..6920045f57 100644
--- a/alib2data/src/automaton/TA/NFTA.h
+++ b/alib2data/src/automaton/TA/NFTA.h
@@ -95,7 +95,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<NFTA>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h
index b140ccb17d..83159f004b 100644
--- a/alib2data/src/automaton/TM/OneTapeDTM.h
+++ b/alib2data/src/automaton/TM/OneTapeDTM.h
@@ -84,7 +84,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<OneTapeDTM>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/common/base.hpp b/alib2data/src/common/base.hpp
index 8fa2fcc330..c8d6ac2264 100644
--- a/alib2data/src/common/base.hpp
+++ b/alib2data/src/common/base.hpp
@@ -30,11 +30,16 @@ class base_helper;
 template<int ID, typename T>
 class base_helper<ID, T> : public base_base<ID + 1> {
 public:
+	//Note: Both versions are here because the static typeId with enable_if is not working in llvm
 	template<typename R, typename std::enable_if < std::is_same< R, T >::value >::type* = nullptr >
 	static int typeId() {
 		return ID;
 	}
 
+	int typeId(const T&) const {
+		return ID;
+	}
+
 	virtual int compare(const T &) const {
 		if(this->selfTypeId() < typeId<T>())
 			return -1;
@@ -51,11 +56,16 @@ public:
 	using base_helper<ID + 1, Types...>::compare;
 	using base_helper<ID + 1, Types...>::typeId;
 
+	//Note: Both versions are here because the static typeId with enable_if is not working in llvm
 	template<typename R, typename std::enable_if < std::is_same< R, T >::value >::type* = nullptr >
 	static int typeId() {
 		return ID;
 	}
 
+	int typeId(const T&) const {
+		return ID;
+	}
+
 	virtual int compare(const T &) const {
 		if(this->selfTypeId() < typeId<T>())
 			return -1;
diff --git a/alib2data/src/common/visitor.hpp b/alib2data/src/common/visitor.hpp
index 2dcba5923d..9b27fab10a 100644
--- a/alib2data/src/common/visitor.hpp
+++ b/alib2data/src/common/visitor.hpp
@@ -56,7 +56,7 @@ public:
 };
 
 template<typename... Types>
-class const_promoting_helper;
+struct const_promoting_helper;
 
 template<typename Tested, typename... Other>
 struct const_promoting_helper<Tested, Other...> {
@@ -100,7 +100,8 @@ struct const_promoting_helper<Tested, Other...> {
 	}
 };
 
-template<> struct const_promoting_helper<>  {
+template<>
+struct const_promoting_helper<>  {
 
 	template<class Desired, class Base, class TargetVisitor>
 	inline static bool tryPromote1(void*, const Desired&, const Base&, const TargetVisitor&) { return false; }
@@ -253,6 +254,8 @@ public:
 template<typename Derived, typename AcceptorBase, typename Base>
 class acceptor : public Base {
 public:
+	using Base::Accept;
+
 	virtual void Accept(void* userData, typename AcceptorBase::visitor_type& visitor) const {
 		visitor.Visit(userData, static_cast<const Derived&>(*this));
 	}
diff --git a/alib2data/src/container/ContainerFromXMLParser.hpp b/alib2data/src/container/ContainerFromXMLParser.hpp
index 11750428cb..7b51869a15 100644
--- a/alib2data/src/container/ContainerFromXMLParser.hpp
+++ b/alib2data/src/container/ContainerFromXMLParser.hpp
@@ -34,6 +34,10 @@ namespace container {
  * Parser used to get general FSM or EpsilonNFA, NFA, DFA from XML parsed into list of Tokens.
  */
 class ContainerFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	ContainerFromXMLParser() {}
+
+private:
 	Container parseContainer(std::deque<sax::Token>& input) const;
 	Container parseContainer(std::deque<sax::Token>& input, const std::set<FEATURES>& features) const;
 
@@ -60,7 +64,7 @@ class ContainerFromXMLParser : public sax::FromXMLParserHelper {
 	template<typename ... Ts>
 	std::variant<Ts...> parseVariant(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 
 public:
 	bool first(const std::deque<sax::Token>& input) const;
diff --git a/alib2data/src/container/ContainerToXMLComposer.hpp b/alib2data/src/container/ContainerToXMLComposer.hpp
index e643f66264..d130bcb88f 100644
--- a/alib2data/src/container/ContainerToXMLComposer.hpp
+++ b/alib2data/src/container/ContainerToXMLComposer.hpp
@@ -30,6 +30,10 @@ namespace container {
  * This class contains methods to print XML representation of automata to the output stream.
  */
 class ContainerToXMLComposer {
+public:
+	ContainerToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of UnknownAutomaton to the output stream.
 	 * @param automaton automaton to print
@@ -67,7 +71,7 @@ class ContainerToXMLComposer {
 	template<typename ... Ts>
 	void compose(std::deque<sax::Token>& output, const std::variant<Ts...>& container) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace container */
diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h
index c4d7aa4ca2..d53a1554f3 100644
--- a/alib2data/src/container/ObjectsMap.h
+++ b/alib2data/src/container/ObjectsMap.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsMap>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsPair.h b/alib2data/src/container/ObjectsPair.h
index f3830f13c3..c10c7e5381 100644
--- a/alib2data/src/container/ObjectsPair.h
+++ b/alib2data/src/container/ObjectsPair.h
@@ -39,7 +39,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsPair>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsSet.h b/alib2data/src/container/ObjectsSet.h
index 16747c020c..ce738a70b1 100644
--- a/alib2data/src/container/ObjectsSet.h
+++ b/alib2data/src/container/ObjectsSet.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsSet>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsVector.h b/alib2data/src/container/ObjectsVector.h
index 1c88f62645..20f23e5445 100644
--- a/alib2data/src/container/ObjectsVector.h
+++ b/alib2data/src/container/ObjectsVector.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectsVector>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h
index 7b3007ac43..1b22e0cfaf 100644
--- a/alib2data/src/exception/AlibException.h
+++ b/alib2data/src/exception/AlibException.h
@@ -64,7 +64,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<AlibException>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/exception/ExceptionFromXMLParser.h b/alib2data/src/exception/ExceptionFromXMLParser.h
index c945181d83..4c5ad16d9c 100644
--- a/alib2data/src/exception/ExceptionFromXMLParser.h
+++ b/alib2data/src/exception/ExceptionFromXMLParser.h
@@ -27,13 +27,17 @@ namespace exception {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class ExceptionFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	ExceptionFromXMLParser() {}
+
+private:
 	AlibException parseException(std::deque<sax::Token>& input) const;
 	AlibException parseException(std::deque<sax::Token>& input, const std::set<FEATURES>& features) const;
 
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace exception */
diff --git a/alib2data/src/exception/ExceptionToXMLComposer.h b/alib2data/src/exception/ExceptionToXMLComposer.h
index e669286ee7..a8529ab0ff 100644
--- a/alib2data/src/exception/ExceptionToXMLComposer.h
+++ b/alib2data/src/exception/ExceptionToXMLComposer.h
@@ -25,6 +25,10 @@ namespace exception {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class ExceptionToXMLComposer {
+public:
+	ExceptionToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of AlibException to the output stream.
 	 * @param string Exception to print
@@ -32,7 +36,7 @@ class ExceptionToXMLComposer {
 	 */
 	void compose(std::deque<sax::Token>& out, const AlibException& exception) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace exception */
diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h
index a974c1b2f9..61816d597d 100644
--- a/alib2data/src/grammar/ContextFree/CFG.h
+++ b/alib2data/src/grammar/ContextFree/CFG.h
@@ -58,7 +58,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<CFG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h
index 5b30c24170..9c68f2bdf0 100644
--- a/alib2data/src/grammar/ContextFree/CNF.h
+++ b/alib2data/src/grammar/ContextFree/CNF.h
@@ -67,7 +67,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<CNF>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
index 9fafdb50e2..901f307ef2 100644
--- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
+++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<EpsilonFreeCFG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h
index 56d14b47f2..3ecaf3607e 100644
--- a/alib2data/src/grammar/ContextFree/GNF.h
+++ b/alib2data/src/grammar/ContextFree/GNF.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<GNF>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h
index 07299fa747..7b95823e1e 100644
--- a/alib2data/src/grammar/ContextFree/LG.h
+++ b/alib2data/src/grammar/ContextFree/LG.h
@@ -63,7 +63,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h
index 733b96d7ce..4df0472e4e 100644
--- a/alib2data/src/grammar/ContextSensitive/CSG.h
+++ b/alib2data/src/grammar/ContextSensitive/CSG.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<CSG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
index c51da8e2cd..d1571896b4 100644
--- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
+++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<NonContractingGrammar>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/GrammarBase.h b/alib2data/src/grammar/GrammarBase.h
index cc08c8f71f..74018b7af9 100644
--- a/alib2data/src/grammar/GrammarBase.h
+++ b/alib2data/src/grammar/GrammarBase.h
@@ -34,6 +34,8 @@ public:
 
 class VisitableConstRGBase : public VisitableGrammarBase::const_visitor_type {
 
+	using VisitableGrammarBase::const_visitor_type::Visit;
+
 	void Visit(void*, const grammar::ContextPreservingUnrestrictedGrammar&) const
 	{
 	    throw exception::AlibException("Unsupported grammar type ContextPreservingUnrestrictedGrammar");
diff --git a/alib2data/src/grammar/GrammarFromStringParser.h b/alib2data/src/grammar/GrammarFromStringParser.h
index 5cbc736073..dc070dfa3b 100644
--- a/alib2data/src/grammar/GrammarFromStringParser.h
+++ b/alib2data/src/grammar/GrammarFromStringParser.h
@@ -26,6 +26,10 @@ struct stringApi;
 namespace grammar {
 
 class GrammarFromStringParser {
+public:
+	GrammarFromStringParser() {}
+
+private:
 	GrammarFromStringLexer m_GrammarLexer;
 
 	std::set<alphabet::Symbol> parseSet(std::istream& input) const;
@@ -58,7 +62,7 @@ class GrammarFromStringParser {
 	ContextPreservingUnrestrictedGrammar parseContextPreservingUnrestrictedGrammar(std::istream& input) const;
 	UnrestrictedGrammar parseUnrestrictedGrammar(std::istream& input) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/GrammarFromXMLParser.h b/alib2data/src/grammar/GrammarFromXMLParser.h
index d999109163..f65ec3b3af 100644
--- a/alib2data/src/grammar/GrammarFromXMLParser.h
+++ b/alib2data/src/grammar/GrammarFromXMLParser.h
@@ -43,6 +43,10 @@ namespace grammar {
  * Parser used to get general FSM or EpsilonNFA, NFA, DFA from XML parsed into list of Tokens.
  */
 class GrammarFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	GrammarFromXMLParser() {}
+
+private:
 	std::set<alphabet::Symbol> parseNonterminalAlphabet(std::deque<sax::Token> &input) const;
 	std::set<alphabet::Symbol> parseTerminalAlphabet(std::deque<sax::Token> &input) const;
 	alphabet::Symbol parseInitialSymbol(std::deque<sax::Token> &input) const;
@@ -90,7 +94,7 @@ class GrammarFromXMLParser : public sax::FromXMLParserHelper {
 	LeftRG parseLeftRG(std::deque<sax::Token>& input) const;
 	LeftLG parseLeftLG(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/grammar/GrammarToStringComposer.h b/alib2data/src/grammar/GrammarToStringComposer.h
index 28a74f9626..5c092076d4 100644
--- a/alib2data/src/grammar/GrammarToStringComposer.h
+++ b/alib2data/src/grammar/GrammarToStringComposer.h
@@ -11,6 +11,10 @@
 namespace grammar {
 
 class GrammarToStringComposer : public VisitableGrammarBase::const_visitor_type {
+public:
+	GrammarToStringComposer() {}
+
+private:
 	void Visit(void*, const LeftLG& grammar) const;
 	void Visit(void*, const LeftRG& grammar) const;
 	void Visit(void*, const RightLG& grammar) const;
diff --git a/alib2data/src/grammar/GrammarToXMLComposer.h b/alib2data/src/grammar/GrammarToXMLComposer.h
index 02ed0798a8..6481191f08 100644
--- a/alib2data/src/grammar/GrammarToXMLComposer.h
+++ b/alib2data/src/grammar/GrammarToXMLComposer.h
@@ -39,6 +39,10 @@ namespace grammar {
  * This class contains methods to print XML representation of automata to the output stream.
  */
 class GrammarToXMLComposer {
+public:
+	GrammarToXMLComposer() {}
+
+private:
 	void composeNonterminalAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const;
 	void composeTerminalAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const;
 	void composeInitialSymbol(std::deque<sax::Token>& out, const alphabet::Symbol& symbol) const;
@@ -92,7 +96,7 @@ class GrammarToXMLComposer {
 	void compose(std::deque<sax::Token>& out, const ContextPreservingUnrestrictedGrammar& grammar) const;
 	void compose(std::deque<sax::Token>& out, const UnrestrictedGrammar& grammar) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h
index 5cbc3a41f3..40a7b1d8e2 100644
--- a/alib2data/src/grammar/Regular/LeftLG.h
+++ b/alib2data/src/grammar/Regular/LeftLG.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LeftLG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h
index f036487d47..6c186196cd 100644
--- a/alib2data/src/grammar/Regular/LeftRG.h
+++ b/alib2data/src/grammar/Regular/LeftRG.h
@@ -149,7 +149,7 @@ public:
 	 * @copydoc alib::base_base::selfTypeId
 	 */
 	virtual int selfTypeId() const {
-		return typeId<LeftRG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h
index 69f53a1ec3..fda7269eed 100644
--- a/alib2data/src/grammar/Regular/RightLG.h
+++ b/alib2data/src/grammar/Regular/RightLG.h
@@ -62,7 +62,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RightLG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h
index ff32ca9644..65c8a487bf 100644
--- a/alib2data/src/grammar/Regular/RightRG.h
+++ b/alib2data/src/grammar/Regular/RightRG.h
@@ -82,7 +82,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<RightRG>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
index 7cd0666b55..54c6ac574c 100644
--- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<ContextPreservingUnrestrictedGrammar>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
index e2fe2d64cd..36b7393c8b 100644
--- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnrestrictedGrammar>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/graph/GraphFromStringParser.h b/alib2data/src/graph/GraphFromStringParser.h
index 379ac016f8..1e31e09d14 100644
--- a/alib2data/src/graph/GraphFromStringParser.h
+++ b/alib2data/src/graph/GraphFromStringParser.h
@@ -21,6 +21,9 @@ namespace graph {
 
 class GraphFromStringParser
 {
+public:
+	GraphFromStringParser() {}
+
 private:
 	Graph parseGraph(std::istream &input) const;
 	DirectedGraph parseDirectedGraph(std::istream &input) const;
@@ -45,7 +48,7 @@ private:
 
 	GraphFromStringLexer lexer;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } // namespace graph
diff --git a/alib2data/src/graph/GraphFromXMLParser.h b/alib2data/src/graph/GraphFromXMLParser.h
index 44af1e37ac..32077493dc 100644
--- a/alib2data/src/graph/GraphFromXMLParser.h
+++ b/alib2data/src/graph/GraphFromXMLParser.h
@@ -22,6 +22,7 @@ namespace graph {
 class GraphFromXMLParser : public sax::FromXMLParserHelper
 {
 public:
+	GraphFromXMLParser() {}
 	bool first(const std::deque<sax::Token> &input) const;
 
 private:
@@ -45,7 +46,7 @@ private:
 	void parseDirectedEdgeValues(std::deque<sax::Token> &input, DirectedGraph &graph) const;
 	void parseUndirectedEdgeValues(std::deque<sax::Token> &input, UndirectedGraph &graph) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } // namespace graph
diff --git a/alib2data/src/graph/GraphToStringComposer.h b/alib2data/src/graph/GraphToStringComposer.h
index 052bf35671..7db1ec0cf4 100644
--- a/alib2data/src/graph/GraphToStringComposer.h
+++ b/alib2data/src/graph/GraphToStringComposer.h
@@ -16,6 +16,8 @@ namespace graph {
 class GraphToStringComposer : public VisitableGraphBase::const_visitor_type, GraphElement::const_visitor_type
 {
 public:
+	GraphToStringComposer() {}
+
 	void compose(std::ostream &out, const Graph &graph) const;
 
 private:
diff --git a/alib2data/src/graph/GraphToXMLComposer.h b/alib2data/src/graph/GraphToXMLComposer.h
index ef876f3668..cae8a17999 100644
--- a/alib2data/src/graph/GraphToXMLComposer.h
+++ b/alib2data/src/graph/GraphToXMLComposer.h
@@ -22,6 +22,9 @@ namespace graph {
 // This class contains methods to print XML representation of graph to the output stream.
 class GraphToXMLComposer : public GraphElement::const_visitor_type
 {
+public:
+	GraphToXMLComposer() {}
+
 private:
 	void Visit(void *data, const Node &node) const;
 	void Visit(void *data, const DirectedEdge &edge) const;
@@ -43,7 +46,7 @@ private:
 	template<typename T>
 	void composeEdgeValues(std::deque<sax::Token> &out, const T &graph) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } // namespace graph
diff --git a/alib2data/src/graph/directed/DirectedEdge.h b/alib2data/src/graph/directed/DirectedEdge.h
index fecb0a71f7..6700f6f040 100644
--- a/alib2data/src/graph/directed/DirectedEdge.h
+++ b/alib2data/src/graph/directed/DirectedEdge.h
@@ -47,7 +47,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<DirectedEdge>();
+		return typeId(*this);
 	}
 
 	friend std::ostream &operator<<(std::ostream &out, const DirectedEdge &node);
diff --git a/alib2data/src/graph/directed/DirectedGraph.h b/alib2data/src/graph/directed/DirectedGraph.h
index e1c309ec22..3cf5b7b0f7 100644
--- a/alib2data/src/graph/directed/DirectedGraph.h
+++ b/alib2data/src/graph/directed/DirectedGraph.h
@@ -69,7 +69,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<DirectedGraph>();
+		return typeId(*this);
 	}
 
 private:
diff --git a/alib2data/src/graph/undirected/UndirectedEdge.h b/alib2data/src/graph/undirected/UndirectedEdge.h
index e0757e6327..2b5a8bf925 100644
--- a/alib2data/src/graph/undirected/UndirectedEdge.h
+++ b/alib2data/src/graph/undirected/UndirectedEdge.h
@@ -47,7 +47,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<UndirectedEdge>();
+		return typeId(*this);
 	}
 
 	friend std::ostream &operator<<(std::ostream &out, const UndirectedEdge &node);
diff --git a/alib2data/src/graph/undirected/UndirectedGraph.h b/alib2data/src/graph/undirected/UndirectedGraph.h
index cff66b121b..26e349bdd3 100644
--- a/alib2data/src/graph/undirected/UndirectedGraph.h
+++ b/alib2data/src/graph/undirected/UndirectedGraph.h
@@ -69,7 +69,7 @@ public:
 
 	int selfTypeId() const override
 	{
-		return typeId<UndirectedGraph>();
+		return typeId(*this);
 	}
 
 private:
diff --git a/alib2data/src/label/HexavigesimalLabel.h b/alib2data/src/label/HexavigesimalLabel.h
index eca737c5dd..f01784ab86 100644
--- a/alib2data/src/label/HexavigesimalLabel.h
+++ b/alib2data/src/label/HexavigesimalLabel.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<HexavigesimalLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/LabelFromStringParser.h b/alib2data/src/label/LabelFromStringParser.h
index 01b676ac1f..17dfb335d2 100644
--- a/alib2data/src/label/LabelFromStringParser.h
+++ b/alib2data/src/label/LabelFromStringParser.h
@@ -24,12 +24,16 @@ struct stringApi;
 namespace label {
 
 class LabelFromStringParser {
+public:
+	LabelFromStringParser() {}
+
+private:
 	LabelFromStringLexer m_Lexer;
 
 	Label parseLabel(std::istream&, const std::set<FEATURES>&) const;
 	Label parseLabel(std::istream&) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace label */
diff --git a/alib2data/src/label/LabelFromXMLParser.h b/alib2data/src/label/LabelFromXMLParser.h
index d7be430e0a..8b3fba646e 100644
--- a/alib2data/src/label/LabelFromXMLParser.h
+++ b/alib2data/src/label/LabelFromXMLParser.h
@@ -34,6 +34,10 @@ namespace label {
  * Parser used to transform sequence of xml tokens to internal representation of Label.
  */
 class LabelFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	LabelFromXMLParser() {}
+
+private:
 	Label parseLabel(std::deque<sax::Token>& input, const std::set<FEATURES>&) const;
 	Label parseLabel(std::deque<sax::Token>& input) const;
 
@@ -44,7 +48,7 @@ class LabelFromXMLParser : public sax::FromXMLParserHelper {
 	LabelPairLabel parseLabelPairLabel(std::deque<sax::Token>& input) const;
 	UniqueLabel parseUniqueLabel(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h
index ca517cb5c3..27ecbf9fa1 100644
--- a/alib2data/src/label/LabelPairLabel.h
+++ b/alib2data/src/label/LabelPairLabel.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LabelPairLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h
index 0976572171..8751408965 100644
--- a/alib2data/src/label/LabelSetLabel.h
+++ b/alib2data/src/label/LabelSetLabel.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<LabelSetLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/LabelToStringComposer.h b/alib2data/src/label/LabelToStringComposer.h
index 8448977750..7e7227182c 100644
--- a/alib2data/src/label/LabelToStringComposer.h
+++ b/alib2data/src/label/LabelToStringComposer.h
@@ -17,6 +17,10 @@ namespace label {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class LabelToStringComposer : public VisitableLabelBase::const_visitor_type {
+public:
+	LabelToStringComposer() {}
+
+private:
 	void Visit(void*, const PrimitiveLabel& label) const;
 	void Visit(void*, const HexavigesimalLabel& label) const;
 	void Visit(void*, const ObjectLabel& label) const;
diff --git a/alib2data/src/label/LabelToXMLComposer.h b/alib2data/src/label/LabelToXMLComposer.h
index 59082154ee..d3cc0d1ff7 100644
--- a/alib2data/src/label/LabelToXMLComposer.h
+++ b/alib2data/src/label/LabelToXMLComposer.h
@@ -25,6 +25,10 @@ namespace label {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class LabelToXMLComposer {
+public:
+	LabelToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of String to the output stream.
 	 * @param string String to print
@@ -46,7 +50,7 @@ class LabelToXMLComposer {
 	void compose(std::deque<sax::Token>& out, const LabelPairLabel& label) const;
 	void compose(std::deque<sax::Token>& out, const UniqueLabel& label) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace label */
diff --git a/alib2data/src/label/ObjectLabel.h b/alib2data/src/label/ObjectLabel.h
index e467f30e95..f4f74013b3 100644
--- a/alib2data/src/label/ObjectLabel.h
+++ b/alib2data/src/label/ObjectLabel.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<ObjectLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h
index 3cff7b1637..1bc84f499e 100644
--- a/alib2data/src/label/PrimitiveLabel.h
+++ b/alib2data/src/label/PrimitiveLabel.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<PrimitiveLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/label/UniqueLabel.h b/alib2data/src/label/UniqueLabel.h
index 4073a89912..d8880d4920 100644
--- a/alib2data/src/label/UniqueLabel.h
+++ b/alib2data/src/label/UniqueLabel.h
@@ -55,7 +55,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<UniqueLabel>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/object/ObjectFromXMLParser.h b/alib2data/src/object/ObjectFromXMLParser.h
index cdcf31d6dd..c50f304615 100644
--- a/alib2data/src/object/ObjectFromXMLParser.h
+++ b/alib2data/src/object/ObjectFromXMLParser.h
@@ -27,10 +27,14 @@ namespace alib {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class ObjectFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	ObjectFromXMLParser() {}
+
+private:
 	Object parseObject(std::deque<sax::Token>& input) const;
 	Void parseVoid(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/object/ObjectToXMLComposer.h b/alib2data/src/object/ObjectToXMLComposer.h
index 7e5ffc85d4..9966984cb5 100644
--- a/alib2data/src/object/ObjectToXMLComposer.h
+++ b/alib2data/src/object/ObjectToXMLComposer.h
@@ -27,6 +27,10 @@ namespace alib {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class ObjectToXMLComposer {
+public:
+	ObjectToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of UnknownAutomaton to the output stream.
 	 * @param automaton automaton to print
@@ -48,7 +52,7 @@ class ObjectToXMLComposer {
 	 */
 	void compose(std::deque<sax::Token>& out, const Void& voidObject) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace alib */
diff --git a/alib2data/src/object/Void.h b/alib2data/src/object/Void.h
index cd400bed8f..001cf44585 100644
--- a/alib2data/src/object/Void.h
+++ b/alib2data/src/object/Void.h
@@ -37,7 +37,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<Void>();
+		return typeId(*this);
 	}
 
 	static Void VOID;
diff --git a/alib2data/src/primitive/Bool.h b/alib2data/src/primitive/Bool.h
index 9561862a09..7ca38b3b3f 100644
--- a/alib2data/src/primitive/Bool.h
+++ b/alib2data/src/primitive/Bool.h
@@ -48,7 +48,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<Bool>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/Character.h b/alib2data/src/primitive/Character.h
index 13aba2a13d..328dd2f28a 100644
--- a/alib2data/src/primitive/Character.h
+++ b/alib2data/src/primitive/Character.h
@@ -49,7 +49,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<Character>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/Integer.h b/alib2data/src/primitive/Integer.h
index 47c01dfdf1..4ac4b7245f 100644
--- a/alib2data/src/primitive/Integer.h
+++ b/alib2data/src/primitive/Integer.h
@@ -48,7 +48,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<Integer>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/PrimitiveFromStringParser.h b/alib2data/src/primitive/PrimitiveFromStringParser.h
index f81c4b1cbe..117d913970 100644
--- a/alib2data/src/primitive/PrimitiveFromStringParser.h
+++ b/alib2data/src/primitive/PrimitiveFromStringParser.h
@@ -24,12 +24,16 @@ struct stringApi;
 namespace primitive {
 
 class PrimitiveFromStringParser {
+public:
+	PrimitiveFromStringParser() {}
+
+private:
 	PrimitiveFromStringLexer m_Lexer;
 
 	Primitive parsePrimitive(std::istream&, const std::set<FEATURES>&) const;
 	Primitive parsePrimitive(std::istream&) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace primitive */
diff --git a/alib2data/src/primitive/PrimitiveFromXMLParser.h b/alib2data/src/primitive/PrimitiveFromXMLParser.h
index 92575ceec2..4a0056cc21 100644
--- a/alib2data/src/primitive/PrimitiveFromXMLParser.h
+++ b/alib2data/src/primitive/PrimitiveFromXMLParser.h
@@ -32,6 +32,10 @@ namespace primitive {
  * Parser used to transform sequence of xml tokens to internal representation of Primitive.
  */
 class PrimitiveFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	PrimitiveFromXMLParser() {}
+
+private:
 	Primitive parsePrimitive(std::deque<sax::Token>& input, const std::set<FEATURES>&) const;
 	Primitive parsePrimitive(std::deque<sax::Token>& input) const;
 
@@ -47,7 +51,7 @@ class PrimitiveFromXMLParser : public sax::FromXMLParserHelper {
 	unsigned parseUnsignedRaw(std::deque<sax::Token>& input) const;
 	bool parseBoolRaw(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/primitive/PrimitiveToStringComposer.h b/alib2data/src/primitive/PrimitiveToStringComposer.h
index b3a08bf894..af9947fe8c 100644
--- a/alib2data/src/primitive/PrimitiveToStringComposer.h
+++ b/alib2data/src/primitive/PrimitiveToStringComposer.h
@@ -17,6 +17,10 @@ namespace primitive {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class PrimitiveToStringComposer : public VisitablePrimitiveBase::const_visitor_type {
+public:
+	PrimitiveToStringComposer() {}
+
+private:
 	void Visit(void*, const Integer& primitive) const;
 	void Visit(void*, const String& primitive) const;
 	void Visit(void*, const Character& primitive) const;
diff --git a/alib2data/src/primitive/PrimitiveToXMLComposer.h b/alib2data/src/primitive/PrimitiveToXMLComposer.h
index 234ebc5acf..b7f28d8f78 100644
--- a/alib2data/src/primitive/PrimitiveToXMLComposer.h
+++ b/alib2data/src/primitive/PrimitiveToXMLComposer.h
@@ -26,7 +26,10 @@ namespace primitive {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class PrimitiveToXMLComposer {
+public:
+	PrimitiveToXMLComposer() {}
 
+private:
 	/**
 	 * Prints XML representation of String to the output stream.
 	 * @param string String to print
@@ -53,7 +56,7 @@ class PrimitiveToXMLComposer {
 	void compose(std::deque<sax::Token>& out, unsigned primitive) const;
 	void compose(std::deque<sax::Token>& out, bool primitive) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace primitive */
diff --git a/alib2data/src/primitive/String.h b/alib2data/src/primitive/String.h
index fe84241bc5..598966faaa 100644
--- a/alib2data/src/primitive/String.h
+++ b/alib2data/src/primitive/String.h
@@ -51,7 +51,7 @@ public:
 	virtual explicit operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId<String>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/primitive/Unsigned.h b/alib2data/src/primitive/Unsigned.h
index faa651f14f..3589ff0a86 100644
--- a/alib2data/src/primitive/Unsigned.h
+++ b/alib2data/src/primitive/Unsigned.h
@@ -48,7 +48,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<Unsigned>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/RegExpAlphabetGetter.h b/alib2data/src/regexp/RegExpAlphabetGetter.h
index 88cea5e1c1..50b5362cf1 100644
--- a/alib2data/src/regexp/RegExpAlphabetGetter.h
+++ b/alib2data/src/regexp/RegExpAlphabetGetter.h
@@ -21,6 +21,8 @@ class RegExpAlphabetGetter : public VisitableRegExpBase::const_visitor_type {
 	void Visit(void*, const FormalRegExp& empty) const;
 
 public:
+	RegExpAlphabetGetter() {}
+
 	/**
 	 * Composes string representation of RegExp.
 	 * @param regexp RegExp to print
diff --git a/alib2data/src/regexp/RegExpFromStringParser.h b/alib2data/src/regexp/RegExpFromStringParser.h
index c3554ac87c..962595375e 100644
--- a/alib2data/src/regexp/RegExpFromStringParser.h
+++ b/alib2data/src/regexp/RegExpFromStringParser.h
@@ -25,6 +25,10 @@ struct stringApi;
 namespace regexp {
 
 class RegExpFromStringParser {
+public:
+	RegExpFromStringParser() {}
+
+private:
 	UnboundedRegExpElement* alternation(std::istream& input) const;
 	UnboundedRegExpElement* alternationCont(std::istream& input, UnboundedRegExpElement* left) const;
 	UnboundedRegExpElement* alternationContCont(std::istream& input, UnboundedRegExpAlternation* left) const;
@@ -41,7 +45,7 @@ class RegExpFromStringParser {
 	RegExp parseRegExp(std::istream& input) const;
 	RegExp parseRegExp(std::istream& input, const std::set<FEATURES>& features) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/RegExpFromXMLParser.h b/alib2data/src/regexp/RegExpFromXMLParser.h
index ccf05f6ae8..dde3fdd037 100644
--- a/alib2data/src/regexp/RegExpFromXMLParser.h
+++ b/alib2data/src/regexp/RegExpFromXMLParser.h
@@ -29,6 +29,10 @@ namespace regexp {
  * Parser used to get RegExp from XML parsed into list of tokens.
  */
 class RegExpFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	RegExpFromXMLParser() {}
+
+private:
 	void parseAlphabet(std::deque<sax::Token>& input, UnboundedRegExp& regexp) const;
 	void parseAlphabet(std::deque<sax::Token>& input, FormalRegExp& regexp) const;
 
@@ -54,7 +58,7 @@ class RegExpFromXMLParser : public sax::FromXMLParserHelper {
 	UnboundedRegExp parseUnboundedRegExp(std::deque<sax::Token>& input) const;
 	FormalRegExp parseFormalRegExp(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/regexp/RegExpToStringComposer.h b/alib2data/src/regexp/RegExpToStringComposer.h
index 1bcee37647..18d4b5c5cc 100644
--- a/alib2data/src/regexp/RegExpToStringComposer.h
+++ b/alib2data/src/regexp/RegExpToStringComposer.h
@@ -16,6 +16,10 @@
 namespace regexp {
 
 class RegExpToStringComposer : public VisitableRegExpBase::const_visitor_type, UnboundedRegExpElement::const_visitor_type, FormalRegExpElement::const_visitor_type {
+public:
+	RegExpToStringComposer() {}
+
+private:
 	void Visit(void*, const UnboundedRegExpAlternation& alternation) const;
 	void Visit(void*, const UnboundedRegExpConcatenation& concatenation) const;
 	void Visit(void*, const UnboundedRegExpIteration& iteration) const;
diff --git a/alib2data/src/regexp/RegExpToXMLComposer.h b/alib2data/src/regexp/RegExpToXMLComposer.h
index e544dfb963..815706e63b 100644
--- a/alib2data/src/regexp/RegExpToXMLComposer.h
+++ b/alib2data/src/regexp/RegExpToXMLComposer.h
@@ -27,6 +27,10 @@ namespace regexp {
  * This class contains methods to print XML representation of regular expression to the output stream.
  */
 class RegExpToXMLComposer : public UnboundedRegExpElement::const_visitor_type, public FormalRegExpElement::const_visitor_type {
+public:
+	RegExpToXMLComposer() {}
+
+private:
 	void Visit(void*, const UnboundedRegExpAlternation& alternation) const;
 	void Visit(void*, const UnboundedRegExpConcatenation& concatenation) const;
 	void Visit(void*, const UnboundedRegExpIteration& iteration) const;
@@ -60,7 +64,7 @@ class RegExpToXMLComposer : public UnboundedRegExpElement::const_visitor_type, p
 	void compose(std::deque<sax::Token>& out, const UnboundedRegExp& regexp) const;
 	void compose(std::deque<sax::Token>& out, const FormalRegExp& regexp) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h
index 40dd4fc51b..922111a88e 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.h
+++ b/alib2data/src/regexp/formal/FormalRegExp.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExp>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
index 2d6e1d20d5..f117643e2b 100644
--- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
@@ -108,7 +108,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpAlternation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
index 16be1ad50c..baf325ebd2 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
@@ -106,7 +106,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpConcatenation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
index 617a9876b4..8d26560db0 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
@@ -69,7 +69,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpEmpty>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
index a4beae2722..002e7a8932 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
@@ -70,7 +70,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpEpsilon>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h
index 25ff175a7b..ca96128de2 100644
--- a/alib2data/src/regexp/formal/FormalRegExpIteration.h
+++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpIteration>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
index bfab54dde6..69ac734e3b 100644
--- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h
+++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
@@ -86,7 +86,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<FormalRegExpSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
index c6ccb04384..ceed4113fa 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExp>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
index 1e01e6c0f1..d1e91d0ef7 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
@@ -102,7 +102,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpAlternation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
index 957bc2fa23..1cbfd61f59 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
@@ -101,7 +101,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpConcatenation>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
index 37135c3ce5..11cdf4243e 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
@@ -68,7 +68,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpEmpty>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
index 66e8501fff..5250a2ce89 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
@@ -69,7 +69,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpEpsilon>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
index f24f90720b..39636d03c2 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
@@ -100,7 +100,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpIteration>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
index 8328d789ac..f08fe3dace 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
@@ -85,7 +85,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnboundedRegExpSymbol>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/CyclicString.cpp b/alib2data/src/string/CyclicString.cpp
index 5161be34bc..13f771b517 100644
--- a/alib2data/src/string/CyclicString.cpp
+++ b/alib2data/src/string/CyclicString.cpp
@@ -98,7 +98,7 @@ int CyclicString::compare(const LinearString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<LinearString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
@@ -118,7 +118,7 @@ int CyclicString::compare(const Epsilon& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<Epsilon>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
diff --git a/alib2data/src/string/CyclicString.h b/alib2data/src/string/CyclicString.h
index 779ec6ab14..e90195188f 100644
--- a/alib2data/src/string/CyclicString.h
+++ b/alib2data/src/string/CyclicString.h
@@ -65,7 +65,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<CyclicString>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/Epsilon.cpp b/alib2data/src/string/Epsilon.cpp
index 7802c8e54d..79f32b2cd6 100644
--- a/alib2data/src/string/Epsilon.cpp
+++ b/alib2data/src/string/Epsilon.cpp
@@ -45,7 +45,7 @@ int Epsilon::compare(const LinearString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<LinearString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
@@ -57,7 +57,7 @@ int Epsilon::compare(const CyclicString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<CyclicString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
diff --git a/alib2data/src/string/Epsilon.h b/alib2data/src/string/Epsilon.h
index 305072d4de..69c22ccc62 100644
--- a/alib2data/src/string/Epsilon.h
+++ b/alib2data/src/string/Epsilon.h
@@ -54,7 +54,7 @@ public:
 	static Epsilon EPSILON;
 
 	virtual int selfTypeId() const {
-		return typeId<Epsilon>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/LinearString.cpp b/alib2data/src/string/LinearString.cpp
index 85d8d5bd19..13baddbb00 100644
--- a/alib2data/src/string/LinearString.cpp
+++ b/alib2data/src/string/LinearString.cpp
@@ -117,7 +117,7 @@ int LinearString::compare(const CyclicString& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<CyclicString>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
@@ -129,7 +129,7 @@ int LinearString::compare(const Epsilon& other) const {
 		return comp(alphabet, other.getAlphabet());
 	}
 
-	if(this->selfTypeId() < typeId<Epsilon>())
+	if(this->selfTypeId() < typeId(other))
 		return -1;
 	else
 		return 1;
diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h
index 208799eef1..67712ca6f8 100644
--- a/alib2data/src/string/LinearString.h
+++ b/alib2data/src/string/LinearString.h
@@ -73,7 +73,7 @@ public:
 	virtual explicit operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<LinearString>();
+		return typeId(*this);
 	}
 };
 
diff --git a/alib2data/src/string/StringAlphabetGetter.h b/alib2data/src/string/StringAlphabetGetter.h
index ec391dba5e..e4ccf3971d 100644
--- a/alib2data/src/string/StringAlphabetGetter.h
+++ b/alib2data/src/string/StringAlphabetGetter.h
@@ -23,6 +23,8 @@ class StringAlphabetGetter : public VisitableStringBase::const_visitor_type {
 	void Visit(void*, const LinearString& empty) const;
 
 public:
+	StringAlphabetGetter() {}
+
 	/**
 	 * Composes string representation of String.
 	 * @param string String to print
diff --git a/alib2data/src/string/StringFromStringParser.h b/alib2data/src/string/StringFromStringParser.h
index 0212a952ad..64654fc0b7 100644
--- a/alib2data/src/string/StringFromStringParser.h
+++ b/alib2data/src/string/StringFromStringParser.h
@@ -24,6 +24,10 @@ struct stringApi;
 namespace string {
 
 class StringFromStringParser {
+public:
+	StringFromStringParser() {}
+
+private:
 	std::vector<alphabet::Symbol> parseContent(std::istream&) const;
 
 	StringFromStringLexer m_StringLexer;
@@ -31,7 +35,7 @@ class StringFromStringParser {
 	String parseString(std::istream&) const;
 	String parseString(std::istream&, const std::set<FEATURES>& features) const;
 
-	template<typename T> friend class alib::stringApi;
+	template<typename T> friend struct alib::stringApi;
 };
 
 } /* namespace string */
diff --git a/alib2data/src/string/StringFromXMLParser.h b/alib2data/src/string/StringFromXMLParser.h
index de39d369fd..72dbfd394e 100644
--- a/alib2data/src/string/StringFromXMLParser.h
+++ b/alib2data/src/string/StringFromXMLParser.h
@@ -32,6 +32,10 @@ namespace string {
  * Parser used to get String from XML parsed into list of tokens.
  */
 class StringFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	StringFromXMLParser() {}
+
+private:
 	std::vector<alphabet::Symbol> parseContentData(std::deque<sax::Token>& input) const;
 	std::set<alphabet::Symbol> parseAlphabet(std::deque<sax::Token> &input) const;
 
@@ -42,7 +46,7 @@ class StringFromXMLParser : public sax::FromXMLParserHelper {
 	CyclicString parseCyclicString(std::deque<sax::Token>& input) const;
 	Epsilon parseEpsilon(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/string/StringToStringComposer.h b/alib2data/src/string/StringToStringComposer.h
index ee6e929bcd..77264e483e 100644
--- a/alib2data/src/string/StringToStringComposer.h
+++ b/alib2data/src/string/StringToStringComposer.h
@@ -17,6 +17,10 @@ namespace string {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class StringToStringComposer : public VisitableStringBase::const_visitor_type {
+public:
+	StringToStringComposer() {}
+
+private:
 	void Visit(void*, const LinearString& string) const;
 	void Visit(void*, const CyclicString& string) const;
 	void Visit(void*, const Epsilon& string) const;
diff --git a/alib2data/src/string/StringToXMLComposer.h b/alib2data/src/string/StringToXMLComposer.h
index 5ad49d5337..72857e478a 100644
--- a/alib2data/src/string/StringToXMLComposer.h
+++ b/alib2data/src/string/StringToXMLComposer.h
@@ -26,6 +26,10 @@ namespace string {
  * This class contains methods to print XML representation of string to the output stream.
  */
 class StringToXMLComposer {
+public:
+	StringToXMLComposer() {}
+
+private:
 	/**
 	 * Prints XML representation of String to the output stream.
 	 * @param string String to print
@@ -44,7 +48,7 @@ class StringToXMLComposer {
 	void compose(std::deque<sax::Token>& out, const CyclicString& string) const;
 	void compose(std::deque<sax::Token>& out, const Epsilon& string) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace string */
diff --git a/alib2data/src/tree/RankedTree/RankedTree.h b/alib2data/src/tree/RankedTree/RankedTree.h
index 14a93b5ff8..d85db6707f 100644
--- a/alib2data/src/tree/RankedTree/RankedTree.h
+++ b/alib2data/src/tree/RankedTree/RankedTree.h
@@ -68,7 +68,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<RankedTree>();
+		return typeId(*this);
 	}
 
 	void nicePrint(std::ostream & os = std::cout) const;
diff --git a/alib2data/src/tree/TreeFromXMLParser.h b/alib2data/src/tree/TreeFromXMLParser.h
index a2ace647cd..a3e26eaa11 100644
--- a/alib2data/src/tree/TreeFromXMLParser.h
+++ b/alib2data/src/tree/TreeFromXMLParser.h
@@ -32,7 +32,10 @@ namespace tree {
  * Parser used to get tree from XML parsed into list of Tokens.
  */
 class TreeFromXMLParser : public sax::FromXMLParserHelper {
+public:
+	TreeFromXMLParser() {}
 
+private:
 	RankedNode * parseRankedNode(std::deque<sax::Token> &input) const;
 	UnrankedNode * parseUnrankedNode(std::deque<sax::Token> &input) const;
 	std::set<alphabet::RankedSymbol> parseRankedAlphabet(std::deque<sax::Token> &input) const;
@@ -44,7 +47,7 @@ class TreeFromXMLParser : public sax::FromXMLParserHelper {
 	RankedTree parseRankedTree(std::deque<sax::Token>& input) const;
 	UnrankedTree parseUnrankedTree(std::deque<sax::Token>& input) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 public:
 	bool first(const std::deque<sax::Token>& input) const;
 };
diff --git a/alib2data/src/tree/TreeToXMLComposer.h b/alib2data/src/tree/TreeToXMLComposer.h
index df71f10d54..512ee8cda2 100644
--- a/alib2data/src/tree/TreeToXMLComposer.h
+++ b/alib2data/src/tree/TreeToXMLComposer.h
@@ -28,7 +28,10 @@ namespace tree {
  * This class contains methods to print XML representation of tree to the output stream.
  */
 class TreeToXMLComposer {
+public:
+	TreeToXMLComposer() {}
 
+private:
 	void composeAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::RankedSymbol>& symbols) const;
 
 	void composeAlphabet(std::deque<sax::Token>& out, const std::set<alphabet::LabeledSymbol>& symbols) const;
@@ -50,7 +53,7 @@ class TreeToXMLComposer {
 
 	void composeNode(std::deque<sax::Token>& out, const UnrankedNode& node) const;
 
-	template<typename T> friend class alib::xmlApi;
+	template<typename T> friend struct alib::xmlApi;
 };
 
 } /* namespace tree */
diff --git a/alib2data/src/tree/UnrankedTree/UnrankedTree.h b/alib2data/src/tree/UnrankedTree/UnrankedTree.h
index c4e6392245..1fb0e36e13 100644
--- a/alib2data/src/tree/UnrankedTree/UnrankedTree.h
+++ b/alib2data/src/tree/UnrankedTree/UnrankedTree.h
@@ -66,7 +66,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId<UnrankedTree>();
+		return typeId(*this);
 	}
 
 	void nicePrint(std::ostream & os = std::cout) const;
diff --git a/alib2data/test-src/automaton/AutomatonTest.cpp b/alib2data/test-src/automaton/AutomatonTest.cpp
index 76733d8382..8779db6825 100644
--- a/alib2data/test-src/automaton/AutomatonTest.cpp
+++ b/alib2data/test-src/automaton/AutomatonTest.cpp
@@ -290,7 +290,7 @@ void AutomatonTest::testNPDATransitions() {
 }
 
 void AutomatonTest::testRHPDATransitions() {
-	automaton::RealTimeHeightDeterministicNPDA automaton(alphabet::Symbol(alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK));
+	automaton::RealTimeHeightDeterministicNPDA automaton{alphabet::Symbol(alphabet::BottomOfTheStackSymbol::BOTTOM_OF_THE_STACK)};
 	automaton.setStates({automaton::State(1), automaton::State(2), automaton::State(3)});
 	automaton.setInitialStates({automaton::State(1)});
 
diff --git a/alib2data/test-src/common/VisitorTest.cpp b/alib2data/test-src/common/VisitorTest.cpp
index a59db252bb..4b6a6fa373 100644
--- a/alib2data/test-src/common/VisitorTest.cpp
+++ b/alib2data/test-src/common/VisitorTest.cpp
@@ -62,7 +62,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId<Tmp1>();
+		return typeId(*this);
 	}
 
 	int getData() const {
@@ -107,7 +107,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId<Tmp2>();
+		return typeId(*this);
 	}
 
 	double getData() const {
@@ -156,7 +156,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId<Tmp3>();
+		return typeId(*this);
 	}
 
 	const std::string& getData() const {
-- 
GitLab