diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h
index f67dc359e638c5e635e6b4ba6ec1608a5dbab5db..422432b38f1b491e4e07b1c5867aa0a575ff459a 100644
--- a/alib2data/src/alphabet/BlankSymbol.h
+++ b/alib2data/src/alphabet/BlankSymbol.h
@@ -38,7 +38,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<BlankSymbol>();
 	}
 
 	static BlankSymbol BLANK;
diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h
index f18851e480a40a61362a5a11e68bf6e1444599ce..91c73bef286461d1ab4fff9cb4c02c08d166cb92 100644
--- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h
+++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h
@@ -38,7 +38,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<BottomOfTheStackSymbol>();
 	}
 
 	static BottomOfTheStackSymbol BOTTOM_OF_THE_STACK;
diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h
index 8a69354bd6f8ff328f921a39c86c206f3b5eb81a..dd1f88c29c1b1040479360a5582b8e9b708208af 100644
--- a/alib2data/src/alphabet/EndSymbol.h
+++ b/alib2data/src/alphabet/EndSymbol.h
@@ -38,7 +38,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<EndSymbol>();
 	}
 
 	static EndSymbol END;
diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h
index 19463b1a3d5403bafde9d1c7559dc2b725e1da2a..720834b9bd58d0b5493486f2c07dcb27c4906e36 100644
--- a/alib2data/src/alphabet/LabeledSymbol.h
+++ b/alib2data/src/alphabet/LabeledSymbol.h
@@ -53,7 +53,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LabeledSymbol>();
 	}
 };
 
diff --git a/alib2data/src/alphabet/Symbol.cpp b/alib2data/src/alphabet/Symbol.cpp
index 258e0fbeea24f4fb577bd2df24548dd62ecbf2fa..5ef6949175cd1dec3f151aefacb34e48bef2a9f2 100644
--- a/alib2data/src/alphabet/Symbol.cpp
+++ b/alib2data/src/alphabet/Symbol.cpp
@@ -16,11 +16,10 @@ namespace alphabet {
 alphabet::Symbol createUniqueSymbol(const alphabet::Symbol& base, const std::set<alphabet::Symbol>& terminalAlphabet, const std::set<alphabet::Symbol>& nonterminalAlphabet) {
 	label::NextLabel nextLabelCreator;
 
-	const alphabet::LabeledSymbol* baseSymbol = dynamic_cast<const alphabet::LabeledSymbol*>(&(base.getData()));
-	if(baseSymbol == NULL)
+	if(alib::ObjectBase::typeId<LabeledSymbol>() != base.getData().selfTypeId())
 		throw exception::AlibException("Could not create unique symbol with nonlabeled base symbol " + (std::string) base + "." );
 
-	label::Label nextLabel = baseSymbol->getLabel();
+	label::Label nextLabel = static_cast<const alphabet::LabeledSymbol&>(base.getData()).getLabel();
 
 	int i = 0;
 	do {
diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h
index 5a8a23a227ac9bb370fa698764ecfac52ba92942..9993c60998e3d37adce31d452bad0ad83e7925d5 100644
--- a/alib2data/src/automaton/FSM/CompactNFA.h
+++ b/alib2data/src/automaton/FSM/CompactNFA.h
@@ -91,7 +91,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<CompactNFA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h
index 6aae39ba6804d526825a1684d310c0af2652fc15..cd5344e6f35027535661c4acb6b036b6146ef4ae 100644
--- a/alib2data/src/automaton/FSM/DFA.h
+++ b/alib2data/src/automaton/FSM/DFA.h
@@ -92,7 +92,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<DFA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h
index 348dead1da57cbe7a44441127aebdbdff85d2975..317e3cb8b40802f405b821934fb075fc898f2f78 100644
--- a/alib2data/src/automaton/FSM/EpsilonNFA.h
+++ b/alib2data/src/automaton/FSM/EpsilonNFA.h
@@ -170,7 +170,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<EpsilonNFA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h
index 6703e34da19ac305a35047a9222c76f68960b4aa..d13f02c02fb6d43451d9b7ca2b6b6a8b38258ec5 100644
--- a/alib2data/src/automaton/FSM/ExtendedNFA.h
+++ b/alib2data/src/automaton/FSM/ExtendedNFA.h
@@ -93,7 +93,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ExtendedNFA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
index e104ce8a511c725dd6096108c88c2dbf0949b7c6..d026d17e22d1f06a3394438621ea5ad86abd9453 100644
--- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
+++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h
@@ -109,7 +109,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<MultiInitialStateNFA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h
index 880ac3d3fda4c80eac8c2df81ade7f438dc6a3cb..0221b9d36a931771108ae32dfd8d299ccffe1140 100644
--- a/alib2data/src/automaton/FSM/NFA.h
+++ b/alib2data/src/automaton/FSM/NFA.h
@@ -107,7 +107,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<NFA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h
index 0605585360f4e71a3a045b071c9f7bceaea37d9e..195f2d44ed04cf1f9a62c157d407e451c41451de 100644
--- a/alib2data/src/automaton/PDA/DPDA.h
+++ b/alib2data/src/automaton/PDA/DPDA.h
@@ -94,7 +94,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<DPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h
index ce9ad393b98cf052e9f7076984caad8543c6b0f5..40e4c13b1154df9ab99de8984cf14660d5071bfd 100644
--- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h
+++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h
@@ -100,7 +100,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<InputDrivenNPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h
index a5efe560eeddd34bde61097f83b0d9e61e442142..cf066b4f4b5b579627c97553a18ac1aa074a60ce 100644
--- a/alib2data/src/automaton/PDA/NPDA.h
+++ b/alib2data/src/automaton/PDA/NPDA.h
@@ -88,7 +88,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<NPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
index d6eda027180aa3a4044a82f937243f9290c5a671..505fec37f09aa5dc12068b77147b48717f167682 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h
@@ -130,7 +130,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<RealTimeHeightDeterministicDPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
index 4db20c948d6dc6e0a87dced9ca5877edd492e4c1..335111cd88eaad95c583a01d15ddb58d90299f4a 100644
--- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
+++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h
@@ -130,7 +130,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<RealTimeHeightDeterministicNPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h
index 48ec8b9e89ec88fb1fb97958d9431ffc08948367..7bb5678904eb7216b072e8ea13be2812ffc5d7ae 100644
--- a/alib2data/src/automaton/PDA/SinglePopDPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h
@@ -93,7 +93,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<SinglePopDPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h
index faf23c975ec993a58ffbe12260d0296581f9e0a0..158f829819fbe14934991e8e2fddae1a348f1ff9 100644
--- a/alib2data/src/automaton/PDA/SinglePopNPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h
@@ -87,7 +87,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<SinglePopNPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
index b4d21594df5153fae1280a11415464965b64c47e..a4560a4c6a8118eac212f1607f660f2fb490ce48 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h
@@ -116,7 +116,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<VisiblyPushdownDPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
index f63db90f3887a2177253ab544cc6974efd2af86d..cb4d663312216da4bbe703f1a20b2382e17662e7 100644
--- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
+++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h
@@ -116,7 +116,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<VisiblyPushdownNPDA>();
 	}
 };
 
diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h
index 5cd77dbbcc744f4f9efe9a810a1e1ffce9632e16..40a366862ae32d1171c0422ca5f2e1636c594936 100644
--- a/alib2data/src/automaton/TM/OneTapeDTM.h
+++ b/alib2data/src/automaton/TM/OneTapeDTM.h
@@ -86,7 +86,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<OneTapeDTM>();
 	}
 };
 
diff --git a/alib2data/src/common/base.hpp b/alib2data/src/common/base.hpp
index 044fa857f24f33e71ec90d2bc8ad5e216bfca30e..54c1a5df1b821d91e99a61060383782e60dd79dd 100644
--- a/alib2data/src/common/base.hpp
+++ b/alib2data/src/common/base.hpp
@@ -16,10 +16,10 @@ namespace alib {
 template<int ID>
 class base_base {
 public:
-	template<typename T>
-	int typeId(const T&) const {
+/*	template<typename T>
+	static int typeId() {
 		return ID;
-	}
+	}*/
 
 	virtual int selfTypeId() const = 0;
 
@@ -34,7 +34,8 @@ class base_helper;
 template<int ID, typename T>
 class base_helper<ID, T> : public base_base<ID + 1> {
 public:
-	virtual int typeId(const T &) const {
+	template<typename R, typename std::enable_if < std::is_same< R, T >::value >::type* = nullptr >
+	static int typeId() {
 		return ID;
 	}
 
@@ -42,8 +43,8 @@ public:
 		return false;
 	}
 
-	virtual bool operator<(const T & other) const {
-		return this->selfTypeId() < typeId(other);
+	virtual bool operator<(const T &) const {
+		return this->selfTypeId() < typeId<T>();
 	}
 };
 
@@ -54,7 +55,8 @@ public:
 	using base_helper<ID + 1, Types...>::operator<;
 	using base_helper<ID + 1, Types...>::typeId;
 
-	virtual int typeId(const T &) const {
+	template<typename R, typename std::enable_if < std::is_same< R, T >::value >::type* = nullptr >
+	static int typeId() {
 		return ID;
 	}
 
@@ -62,8 +64,8 @@ public:
 		return false;
 	}
 
-	virtual bool operator<(const T & other) const {
-		return this->selfTypeId() < typeId(other);
+	virtual bool operator<(const T &) const {
+		return this->selfTypeId() < typeId<T>();
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h
index 71503f3a2f7f87f08af0259cda427a2427f5438c..a2b989e8696ae340444932f94e22af8a6802f930 100644
--- a/alib2data/src/container/ObjectsMap.h
+++ b/alib2data/src/container/ObjectsMap.h
@@ -38,7 +38,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ObjectsMap>();
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsPair.h b/alib2data/src/container/ObjectsPair.h
index fe8691ab17f604c7a82822ce10036690d376c94a..270dcdea62eeaa09f08f220cc2ba87dd510e0cb9 100644
--- a/alib2data/src/container/ObjectsPair.h
+++ b/alib2data/src/container/ObjectsPair.h
@@ -40,7 +40,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ObjectsPair>();
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsSet.h b/alib2data/src/container/ObjectsSet.h
index 7aadcb917a7c9817a3a5bae6b1653c956d8e0df7..0a5fec7f9f28d1f70187cbd7b2b282b2d4ffbf17 100644
--- a/alib2data/src/container/ObjectsSet.h
+++ b/alib2data/src/container/ObjectsSet.h
@@ -38,7 +38,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ObjectsSet>();
 	}
 };
 
diff --git a/alib2data/src/container/ObjectsVector.h b/alib2data/src/container/ObjectsVector.h
index 4396d458e6536ec3413f04437238c5cad49745b8..03e89ebad71a92b226d32a1212421195142da86c 100644
--- a/alib2data/src/container/ObjectsVector.h
+++ b/alib2data/src/container/ObjectsVector.h
@@ -38,7 +38,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ObjectsVector>();
 	}
 };
 
diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h
index 4b90853c48e28cce47d7b5cd4dbfba502dbade5a..bcdb502fd85b1aed7467d8c7c946d81efadf869a 100644
--- a/alib2data/src/exception/AlibException.h
+++ b/alib2data/src/exception/AlibException.h
@@ -63,7 +63,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<AlibException>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h
index 9e014389deb7822e45b8c8bfbf3bddac9ae50498..bb36acd0637c90100138d6f9f46f2faa893d8cec 100644
--- a/alib2data/src/grammar/ContextFree/CFG.h
+++ b/alib2data/src/grammar/ContextFree/CFG.h
@@ -60,7 +60,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<CFG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h
index 833b85e80c2c6cf41a3a6c1402a6b53f0716bd1b..af5c56a4091951a9115e917fcdd2807ec1fb22c4 100644
--- a/alib2data/src/grammar/ContextFree/CNF.h
+++ b/alib2data/src/grammar/ContextFree/CNF.h
@@ -69,7 +69,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<CNF>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
index e2751e1e8dc3ca26b0ce0e366458bbfd01fef7d8..629b8cfaf38cfa6798c3d7718cb93f4fc0a271f1 100644
--- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
+++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
@@ -64,7 +64,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<EpsilonFreeCFG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h
index 43134473fc746edb7acd1c64f75e8346d9ca4255..2a9caa5336b4aaf5d48b240dea2dc195f1a376a7 100644
--- a/alib2data/src/grammar/ContextFree/GNF.h
+++ b/alib2data/src/grammar/ContextFree/GNF.h
@@ -63,7 +63,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<GNF>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h
index 56b5d344421fedadb83ceb858ee0e185e334c405..7c56b5e9dc4d6e784f6b57a0a33cff5edd64f0a0 100644
--- a/alib2data/src/grammar/ContextFree/LG.h
+++ b/alib2data/src/grammar/ContextFree/LG.h
@@ -65,7 +65,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h
index 760a9319eb5ac6ae035c3fc139a10cc879b2a6ab..f75ac10870b67e197728fad4fff21816ae59569c 100644
--- a/alib2data/src/grammar/ContextSensitive/CSG.h
+++ b/alib2data/src/grammar/ContextSensitive/CSG.h
@@ -57,7 +57,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<CSG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
index 4b69b41aba6f09dba849d2123ba83f171184097b..fc5cf10cd0b3fc3eefa31ef9f613987689965aed 100644
--- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
+++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
@@ -57,7 +57,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<NonContractingGrammar>();
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h
index a972d9aa55171a86e8a1546bbe581fa5259d75d1..068b835035d62f8de988405ac66d6ecc1e64d551 100644
--- a/alib2data/src/grammar/Regular/LeftLG.h
+++ b/alib2data/src/grammar/Regular/LeftLG.h
@@ -64,7 +64,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LeftLG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h
index aee1e8c96f3bc6548d08d2ff19c6a1cbe58621cf..680031560518dd4aaadd9ba610355b51cf940bbe 100644
--- a/alib2data/src/grammar/Regular/LeftRG.h
+++ b/alib2data/src/grammar/Regular/LeftRG.h
@@ -163,7 +163,7 @@ public:
 	 * @copydoc alib::base_base::selfTypeId
 	 */
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LeftRG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h
index b31d5476cc25bc12e0dc9de72ce0d25e3f2dbe4a..fc0d2cf7d37190ee869e8c1160939d8cd1075d85 100644
--- a/alib2data/src/grammar/Regular/RightLG.h
+++ b/alib2data/src/grammar/Regular/RightLG.h
@@ -64,7 +64,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<RightLG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h
index eb173e4cb94972e9976b52fa15e081b965a43d21..b21e848b73a0a981da16dee7757e8b5fe56e5d5a 100644
--- a/alib2data/src/grammar/Regular/RightRG.h
+++ b/alib2data/src/grammar/Regular/RightRG.h
@@ -84,7 +84,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<RightRG>();
 	}
 };
 
diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
index c5c425f843bc89a2b29f70959affa06401aef553..bb23181be01cfe7e749af6a824165b90c55bb90a 100644
--- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
@@ -53,7 +53,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ContextPreservingUnrestrictedGrammar>();
 	}
 };
 
diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
index 9639bd92b52b0d5343eb9d0ae2e46f9366433168..46ec38d06f8856bf87c626573c0228d4fa2db2ba 100644
--- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
@@ -53,7 +53,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<UnrestrictedGrammar>();
 	}
 };
 
diff --git a/alib2data/src/label/HexavigesimalLabel.h b/alib2data/src/label/HexavigesimalLabel.h
index 206cce8c39580ed6c777f2a2cda2198062e4fb1c..ce844d5ab898849536ccdf54384909a5664c960a 100644
--- a/alib2data/src/label/HexavigesimalLabel.h
+++ b/alib2data/src/label/HexavigesimalLabel.h
@@ -52,7 +52,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<HexavigesimalLabel>();
 	}
 };
 
diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h
index 1bfa1c5a272c06babee0ed37143d6ad6f38e4476..92414856909a79782a2a00e0180532498b1f886f 100644
--- a/alib2data/src/label/LabelPairLabel.h
+++ b/alib2data/src/label/LabelPairLabel.h
@@ -56,7 +56,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LabelPairLabel>();
 	}
 };
 
diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h
index 5d1bd413c9acd5fa38a2bef354fcd994e5346a11..9bdf8266c3ed7e3e957411706d1fa498f6898e0c 100644
--- a/alib2data/src/label/LabelSetLabel.h
+++ b/alib2data/src/label/LabelSetLabel.h
@@ -56,7 +56,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LabelSetLabel>();
 	}
 };
 
diff --git a/alib2data/src/label/ObjectLabel.h b/alib2data/src/label/ObjectLabel.h
index e5bdc9ae0ec688d789de8fdba4d8f2a1037c8c27..a4bc6ff70fe448ccda0c4cf19ec60bf55f370d35 100644
--- a/alib2data/src/label/ObjectLabel.h
+++ b/alib2data/src/label/ObjectLabel.h
@@ -55,7 +55,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<ObjectLabel>();
 	}
 };
 
diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h
index 94498412245855a248bcf007f9758bee0eec66bb..784f9fb44e33593dea00af7417dc4fd951e16dc4 100644
--- a/alib2data/src/label/PrimitiveLabel.h
+++ b/alib2data/src/label/PrimitiveLabel.h
@@ -54,7 +54,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<PrimitiveLabel>();
 	}
 };
 
diff --git a/alib2data/src/object/Void.h b/alib2data/src/object/Void.h
index bfbea1238f9dc6fa5e72b331fccce69812c9ff80..fa35b2295d5a529055154770810434cef823134b 100644
--- a/alib2data/src/object/Void.h
+++ b/alib2data/src/object/Void.h
@@ -40,7 +40,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Void>();
 	}
 
 	static Void VOID;
diff --git a/alib2data/src/primitive/Character.h b/alib2data/src/primitive/Character.h
index bfeae825b6cc4b58e29989df100dc448811d781f..ad358b7bba37e5ab17d4d002b8a109a596016d30 100644
--- a/alib2data/src/primitive/Character.h
+++ b/alib2data/src/primitive/Character.h
@@ -53,7 +53,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Character>();
 	}
 };
 
diff --git a/alib2data/src/primitive/Integer.h b/alib2data/src/primitive/Integer.h
index 0020f6942400c0058c2934f9a153091d554c079a..e70ca141c764e7aacfe1ce6a64332f12878c362f 100644
--- a/alib2data/src/primitive/Integer.h
+++ b/alib2data/src/primitive/Integer.h
@@ -52,7 +52,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Integer>();
 	}
 };
 
diff --git a/alib2data/src/primitive/String.h b/alib2data/src/primitive/String.h
index 297df0369c505bfbb1f917ee2c86924de9d6da68..5007dfd8fd2e0698f2bdbbd342dd98ac98da73e9 100644
--- a/alib2data/src/primitive/String.h
+++ b/alib2data/src/primitive/String.h
@@ -55,7 +55,7 @@ public:
 	virtual operator std::string () const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<String>();
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h
index c1df2695dbc7727a02301a8c6c205eb583f2540c..2322d436948f66c00e3f4b02d30479cce391ed67 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.h
+++ b/alib2data/src/regexp/formal/FormalRegExp.h
@@ -123,7 +123,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<FormalRegExp>();
 	}
 };
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp
index 81b85de9aa73a9edef08c82d6f5a45d1f413fe7d..a7dbf0cfb728fb3e723d1188aee82d3c1bb87837 100644
--- a/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.cpp
@@ -8,6 +8,7 @@
 #include "FormalRegExpAlternation.h"
 #include "../../exception/AlibException.h"
 #include "../unbounded/UnboundedRegExpAlternation.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -176,4 +177,10 @@ void FormalRegExpAlternation::computeMinimalAlphabet( std::set<alphabet::Symbol>
 	right->computeMinimalAlphabet(alphabet);
 }
 
+FormalRegExpAlternation::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
index de9886b04a29aa374db85fb3b4830685ca7afa89..cdc61ee5110139de630e7a595b05606f709d2143 100644
--- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h
@@ -98,6 +98,11 @@ public:
 	 */
 	virtual void operator>>(std::ostream& out) const;
 
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<FormalRegExpAlternation>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
index c65187ec1f1e0ce7dc6eaafa57058898b2cbadc8..41154f6e3cc0c3e964277b0bebf660d4409d7d65 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
@@ -176,4 +176,10 @@ void FormalRegExpConcatenation::computeMinimalAlphabet( std::set<alphabet::Symbo
 	right->computeMinimalAlphabet(alphabet);
 }
 
+FormalRegExpConcatenation::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
index 91405bdc4f0242e63e1c8b5c5afb4878be4613b8..ecc788c3dfed58d2963207e64722adf8ac5b75bc 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h
@@ -10,6 +10,7 @@
 
 #include <vector>
 #include "FormalRegExpElement.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -94,6 +95,12 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<FormalRegExpConcatenation>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpElement.cpp b/alib2data/src/regexp/formal/FormalRegExpElement.cpp
index 612bfc591c5977a276809abf86f3aea9a4309f87..404c2d5a1af6795b5f0c7d5a6deea79df1f18a7e 100644
--- a/alib2data/src/regexp/formal/FormalRegExpElement.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpElement.cpp
@@ -16,75 +16,4 @@ FormalRegExpElement::FormalRegExpElement() : parentRegExp(NULL) {
 
 }
 
-FormalRegExpElement::~FormalRegExpElement() noexcept {
-
-}
-
-bool FormalRegExpElement::operator>=(const FormalRegExpElement& other) const {
-	return !(*this < other);
-}
-
-bool FormalRegExpElement::operator<=(const FormalRegExpElement& other) const {
-	return !(*this > other);
-}
-
-bool FormalRegExpElement::operator!=(const FormalRegExpElement& other) const {
-	return !(*this == other);
-}
-
-
-bool FormalRegExpElement::operator<(const FormalRegExpConcatenation& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool FormalRegExpElement::operator<(const FormalRegExpAlternation& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool FormalRegExpElement::operator<(const FormalRegExpIteration& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool FormalRegExpElement::operator<(const FormalRegExpSymbol& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool FormalRegExpElement::operator<(const FormalRegExpEpsilon& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool FormalRegExpElement::operator<(const FormalRegExpEmpty& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-
-bool FormalRegExpElement::operator==(const FormalRegExpConcatenation&) const {
-	return false;
-}
-
-bool FormalRegExpElement::operator==(const FormalRegExpAlternation&) const {
-	return false;
-}
-
-bool FormalRegExpElement::operator==(const FormalRegExpIteration&) const {
-	return false;
-}
-
-bool FormalRegExpElement::operator==(const FormalRegExpSymbol&) const {
-	return false;
-}
-
-bool FormalRegExpElement::operator==(const FormalRegExpEpsilon&) const {
-	return false;
-}
-
-bool FormalRegExpElement::operator==(const FormalRegExpEmpty&) const {
-	return false;
-}
-
-std::ostream& operator<<(std::ostream& out, const FormalRegExpElement& regexp) {
-	regexp >> out;
-	return out;
-}
-
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpElement.h b/alib2data/src/regexp/formal/FormalRegExpElement.h
index e02d2d5382d34ad67c6a5c2828c9696326256b05..30ff34d1c4615df7dd310934ff50111f7a29d1f3 100644
--- a/alib2data/src/regexp/formal/FormalRegExpElement.h
+++ b/alib2data/src/regexp/formal/FormalRegExpElement.h
@@ -30,7 +30,15 @@ class FormalRegExpElement;
 /**
  * Abstract class representing element in the regular expression. Can be operator or symbol.
  */
-class FormalRegExpElement : public std::acceptor_base<FormalRegExpElement, FormalRegExpAlternation, FormalRegExpConcatenation, FormalRegExpIteration, FormalRegExpSymbol, FormalRegExpEmpty, FormalRegExpEpsilon> {
+typedef std::acceptor_base<FormalRegExpElement,
+			FormalRegExpAlternation, FormalRegExpConcatenation, FormalRegExpIteration, FormalRegExpSymbol, FormalRegExpEmpty, FormalRegExpEpsilon
+	> VisitableFormalRegExpElement;
+
+class FormalRegExpElement :
+	public alib::base<
+			FormalRegExpElement,
+			FormalRegExpAlternation, FormalRegExpConcatenation, FormalRegExpIteration, FormalRegExpSymbol, FormalRegExpEmpty, FormalRegExpEpsilon
+	>, public VisitableFormalRegExpElement {
 protected:
 	/* 
 	 * Parent regexp contanining this instance of RegExpElement
@@ -62,14 +70,6 @@ protected:
 	
 public:
 	explicit FormalRegExpElement();
-	
-	/**
-	 * Creates copy of the element.
-	 * @return copy of the element
-	 */
-	virtual FormalRegExpElement* clone() const = 0;
-	
-	virtual FormalRegExpElement* plunder() && = 0;
 
 	/**
 	 * Creates copy of the element.
@@ -77,44 +77,6 @@ public:
 	 */
 	virtual UnboundedRegExpElement* cloneAsUnbounded() const = 0;
 
-	virtual ~FormalRegExpElement() noexcept;
-
-	// RegExpEmpty < RegExpEpsilon < RegExpSymbol < RegExpIteration < RegExpAlternation < RegExpConcatenation
-	virtual bool operator<(const FormalRegExpElement&) const = 0;
-	virtual bool operator==(const FormalRegExpElement&) const = 0;
-	virtual bool operator>(const FormalRegExpElement&) const = 0;
-
-	virtual bool operator>=(const FormalRegExpElement&) const;
-	virtual bool operator<=(const FormalRegExpElement&) const;
-	virtual bool operator!=(const FormalRegExpElement&) const;
-
-	virtual bool operator<(const FormalRegExpConcatenation&) const;
-	virtual bool operator<(const FormalRegExpAlternation&) const;
-	virtual bool operator<(const FormalRegExpIteration&) const;
-	virtual bool operator<(const FormalRegExpSymbol&) const;
-	virtual bool operator<(const FormalRegExpEpsilon&) const;
-	virtual bool operator<(const FormalRegExpEmpty&) const;
-
-	virtual bool operator==(const FormalRegExpConcatenation&) const;
-	virtual bool operator==(const FormalRegExpAlternation&) const;
-	virtual bool operator==(const FormalRegExpIteration&) const;
-	virtual bool operator==(const FormalRegExpSymbol&) const;
-	virtual bool operator==(const FormalRegExpEpsilon&) const;
-	virtual bool operator==(const FormalRegExpEmpty&) const;
-	
-	/**
-	 * Prints XML representation of the RegExp to the output stream.
-	 * @param out output stream to which print the RegExp
-	 */
-	virtual void operator>>(std::ostream& out) const = 0;
-	
-	/**
-	 * Prints XML representation of the RegExp to the output stream.
-	 * @param out output stream to which print the RegExp
-	 * @param regexp RegExp to print
-	 */
-	friend std::ostream& operator<<(std::ostream& out, const FormalRegExpElement& regexp);
-
 	friend class FormalRegExp;
 	
 	friend class FormalRegExpAlternation;
diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp
index fb070961aa501a3e6e69a11e95f86c08cc2b530c..a55e9a92bd789f24ab28b301e24addef5cb37419 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.cpp
@@ -83,4 +83,10 @@ void FormalRegExpEmpty::computeMinimalAlphabet( std::set<alphabet::Symbol>&) con
 
 }
 
+FormalRegExpEmpty::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
index e3417bb381e709221da982d46c1f331c9097b7de..300cd803fab8c95dd0e183497d3236f05c1dbab6 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h
@@ -9,6 +9,7 @@
 #define FORMAL_REG_EXP_EMPTY_H_
 
 #include "FormalRegExpElement.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -65,6 +66,12 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<FormalRegExpEmpty>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp
index 1629e334e0e87ad87b4cea5791e019bface344e3..8d3d8563a23450d336dff6880af2e8020d31c815 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.cpp
@@ -7,6 +7,7 @@
 
 #include "FormalRegExpEpsilon.h"
 #include "../unbounded/UnboundedRegExpEpsilon.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -83,4 +84,10 @@ void FormalRegExpEpsilon::computeMinimalAlphabet( std::set<alphabet::Symbol>&) c
 
 }
 
+FormalRegExpEpsilon::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
index 1666c23c501f031debc24ff4027c712c9bd9c61a..e146862bca84f63d9780ee32765eb513935aa3c8 100644
--- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
+++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h
@@ -9,6 +9,7 @@
 #define FORMAL_REG_EXP_EPSILON_H_
 
 #include "FormalRegExpElement.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -66,6 +67,12 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<FormalRegExpEpsilon>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp
index f255ee33dab2a9ba4b7fb446988079b19df863e0..6ee36586d2c4823c93e595813bf536f16d3b7fa9 100644
--- a/alib2data/src/regexp/formal/FormalRegExpIteration.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpIteration.cpp
@@ -9,6 +9,7 @@
 #include "../../exception/AlibException.h"
 
 #include "../unbounded/UnboundedRegExpIteration.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -130,5 +131,11 @@ void FormalRegExpIteration::computeMinimalAlphabet( std::set<alphabet::Symbol>&
 	element->computeMinimalAlphabet(alphabet);
 }
 
+FormalRegExpIteration::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h
index e777b0e4337970298824db5ca4b9cd8cc1fd28f1..ad71fca8bc19e20573e0c6f6a8e139d5474bfe36 100644
--- a/alib2data/src/regexp/formal/FormalRegExpIteration.h
+++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h
@@ -90,6 +90,12 @@ public:
 	 * @copydoc FormalRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<FormalRegExpIteration>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp
index 52d255b51ee4a084b45b0f1a36a6b34e16b03d66..6849734da8f49191993a6b0d0dd4e31b252065b6 100644
--- a/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.cpp
@@ -7,6 +7,7 @@
 
 #include "FormalRegExpSymbol.h"
 #include "../unbounded/UnboundedRegExpSymbol.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -121,5 +122,11 @@ const alphabet::Symbol& FormalRegExpSymbol::getSymbol() const {
 	return this->symbol;
 }
 
+FormalRegExpSymbol::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
 
diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
index 85e438df57cb5cb9a89a4f7d89f9acbaad03e07a..05cbbb12198bb97b094a330e0d46c450230921fc 100644
--- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h
+++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h
@@ -83,6 +83,12 @@ public:
 	 * Returns the string representation of RegExp Symbol.
 	 */
 	const alphabet::Symbol& getSymbol() const;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<FormalRegExpSymbol>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
index 28964b5f73058ea08486eeae273a954f157bd558..81a0f29af354085e69bfdb42ebf585d7fd0cda4c 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
@@ -123,7 +123,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<UnboundedRegExp>();
 	}
 };
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp
index 66656f173c274ee5beace76456381d913377f423..52f17c3fccefaeac1ec41bc03a4bc0a3c228a35d 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.cpp
@@ -9,6 +9,7 @@
 #include "../../exception/AlibException.h"
 #include "../formal/FormalRegExpAlternation.h"
 #include "../formal/FormalRegExpEmpty.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -176,4 +177,10 @@ void UnboundedRegExpAlternation::computeMinimalAlphabet( std::set<alphabet::Symb
 		child->computeMinimalAlphabet(alphabet);
 }
 
+UnboundedRegExpAlternation::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
index 94d5ee5e47f1335487e14a418257c78f8c780a3d..18b9dec3a776af697f014f46a41278c99ba06b39 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h
@@ -95,6 +95,12 @@ public:
 	virtual void operator>>(std::ostream& out) const;
 
 	friend class RegExpOptimize;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<UnboundedRegExpAlternation>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp
index f932c21a73d0f4a4dc00b64fd8f061032ef75b77..96a9f65834c06035b05eb7ff25df5b4f4f76ab3d 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.cpp
@@ -9,6 +9,7 @@
 #include "../../exception/AlibException.h"
 #include "../formal/FormalRegExpConcatenation.h"
 #include "../formal/FormalRegExpEpsilon.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -175,4 +176,10 @@ void UnboundedRegExpConcatenation::computeMinimalAlphabet( std::set<alphabet::Sy
 		child->computeMinimalAlphabet(alphabet);
 }
 
+UnboundedRegExpConcatenation::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
index 7b47cb953347de851e608deb8943183195c8950a..feb155a2eb9cbfdb123dc38b3e371552da260bea 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h
@@ -94,6 +94,12 @@ public:
 	virtual void operator>>(std::ostream& out) const;
 	
 	friend class RegExpOptimize;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<UnboundedRegExpConcatenation>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.cpp
index 499e4cb734a3e8a9276e3dc3a7e77994dc857b35..4c631bc7bb69704cd91c2e661b78bd1b142d8118 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.cpp
@@ -16,75 +16,4 @@ UnboundedRegExpElement::UnboundedRegExpElement() : parentRegExp(NULL) {
 
 }
 
-UnboundedRegExpElement::~UnboundedRegExpElement() noexcept {
-
-}
-
-bool UnboundedRegExpElement::operator>=(const UnboundedRegExpElement& other) const {
-	return !(*this < other);
-}
-
-bool UnboundedRegExpElement::operator<=(const UnboundedRegExpElement& other) const {
-	return !(*this > other);
-}
-
-bool UnboundedRegExpElement::operator!=(const UnboundedRegExpElement& other) const {
-	return !(*this == other);
-}
-
-
-bool UnboundedRegExpElement::operator<(const UnboundedRegExpConcatenation& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool UnboundedRegExpElement::operator<(const UnboundedRegExpAlternation& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool UnboundedRegExpElement::operator<(const UnboundedRegExpIteration& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool UnboundedRegExpElement::operator<(const UnboundedRegExpSymbol& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool UnboundedRegExpElement::operator<(const UnboundedRegExpEpsilon& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-bool UnboundedRegExpElement::operator<(const UnboundedRegExpEmpty& other) const {
-	return typeid(*this).before(typeid(other));
-}
-
-
-bool UnboundedRegExpElement::operator==(const UnboundedRegExpConcatenation&) const {
-	return false;
-}
-
-bool UnboundedRegExpElement::operator==(const UnboundedRegExpAlternation&) const {
-	return false;
-}
-
-bool UnboundedRegExpElement::operator==(const UnboundedRegExpIteration&) const {
-	return false;
-}
-
-bool UnboundedRegExpElement::operator==(const UnboundedRegExpSymbol&) const {
-	return false;
-}
-
-bool UnboundedRegExpElement::operator==(const UnboundedRegExpEpsilon&) const {
-	return false;
-}
-
-bool UnboundedRegExpElement::operator==(const UnboundedRegExpEmpty&) const {
-	return false;
-}
-
-std::ostream& operator<<(std::ostream& out, const UnboundedRegExpElement& regexp) {
-	regexp >> out;
-	return out;
-}
-
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h
index 9d6ee37cec27443f46a389efb3d827a8a6ac96e6..b057c8d0a2caf23d7b567fc24c00441ac1acc6f4 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h
@@ -30,7 +30,15 @@ class UnboundedRegExpElement;
 /**
  * Abstract class representing element in the regular expression. Can be operator or symbol.
  */
-class UnboundedRegExpElement : public std::acceptor_base<UnboundedRegExpElement, UnboundedRegExpAlternation, UnboundedRegExpConcatenation, UnboundedRegExpIteration, UnboundedRegExpSymbol, UnboundedRegExpEmpty, UnboundedRegExpEpsilon> {
+typedef std::acceptor_base<UnboundedRegExpElement,
+			UnboundedRegExpAlternation, UnboundedRegExpConcatenation, UnboundedRegExpIteration, UnboundedRegExpSymbol, UnboundedRegExpEmpty, UnboundedRegExpEpsilon
+	> VisitableUnboundedRegExpElement;
+
+class UnboundedRegExpElement :
+	public alib::base<
+			UnboundedRegExpElement,
+			UnboundedRegExpAlternation, UnboundedRegExpConcatenation, UnboundedRegExpIteration, UnboundedRegExpSymbol, UnboundedRegExpEmpty, UnboundedRegExpEpsilon
+	>, public VisitableUnboundedRegExpElement {
 protected:
 	/**
 	 * Parent regexp contanining this instance of RegExpElement
@@ -63,58 +71,12 @@ protected:
 public:
 	explicit UnboundedRegExpElement();
 	
-	/**
-	 * Creates copy of the element.
-	 * @return copy of the element
-	 */
-	virtual UnboundedRegExpElement* clone() const = 0;
-	
-	virtual UnboundedRegExpElement* plunder() && = 0;
-
 	/**
 	 * Creates copy of the element.
 	 * @return copy of the element
 	 */
 	virtual FormalRegExpElement* cloneAsFormal() const = 0;
 
-	virtual ~UnboundedRegExpElement() noexcept;
-
-	// RegExpEmpty < RegExpEpsilon < RegExpSymbol < RegExpIteration < RegExpAlternation < RegExpConcatenation
-	virtual bool operator<(const UnboundedRegExpElement&) const = 0;
-	virtual bool operator==(const UnboundedRegExpElement&) const = 0;
-	virtual bool operator>(const UnboundedRegExpElement&) const = 0;
-
-	virtual bool operator>=(const UnboundedRegExpElement&) const;
-	virtual bool operator<=(const UnboundedRegExpElement&) const;
-	virtual bool operator!=(const UnboundedRegExpElement&) const;
-
-	virtual bool operator<(const UnboundedRegExpConcatenation&) const;
-	virtual bool operator<(const UnboundedRegExpAlternation&) const;
-	virtual bool operator<(const UnboundedRegExpIteration&) const;
-	virtual bool operator<(const UnboundedRegExpSymbol&) const;
-	virtual bool operator<(const UnboundedRegExpEpsilon&) const;
-	virtual bool operator<(const UnboundedRegExpEmpty&) const;
-
-	virtual bool operator==(const UnboundedRegExpConcatenation&) const;
-	virtual bool operator==(const UnboundedRegExpAlternation&) const;
-	virtual bool operator==(const UnboundedRegExpIteration&) const;
-	virtual bool operator==(const UnboundedRegExpSymbol&) const;
-	virtual bool operator==(const UnboundedRegExpEpsilon&) const;
-	virtual bool operator==(const UnboundedRegExpEmpty&) const;
-	
-	/**
-	 * Prints XML representation of the RegExp to the output stream.
-	 * @param out output stream to which print the RegExp
-	 */
-	virtual void operator>>(std::ostream& out) const = 0;
-	
-	/**
-	 * Prints XML representation of the RegExp to the output stream.
-	 * @param out output stream to which print the RegExp
-	 * @param regexp RegExp to print
-	 */
-	friend std::ostream& operator<<(std::ostream& out, const UnboundedRegExpElement& regexp);
-
 	friend class UnboundedRegExp;
 	
 	friend class UnboundedRegExpAlternation;
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp
index 11226123f39acd3b516691925ea227d85198d544..06d15fa34e3eeb39c3e46cd519c09c057325f673 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.cpp
@@ -7,6 +7,7 @@
 
 #include "UnboundedRegExpEmpty.h"
 #include "../formal/FormalRegExpEmpty.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -83,4 +84,10 @@ void UnboundedRegExpEmpty::computeMinimalAlphabet( std::set<alphabet::Symbol>&)
 
 }
 
+UnboundedRegExpEmpty::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
index cdae30504c6f7d9736a3307b24e3c81f49d95ca6..97fd1c08feb73ec7e2adcd4a6aee1b1eaa44f767 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h
@@ -65,7 +65,12 @@ public:
 	 * @copydoc UnboundedRegExpElement::operator>>() const
 	 */
 	virtual void operator>>(std::ostream& out) const;
-	
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<UnboundedRegExpEmpty>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp
index 565211a136f79fc47b4b1c6a7a5eb841873bc2cf..f190a6055fd3219863810c7a9a643276fdb4c647 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.cpp
@@ -7,6 +7,7 @@
 
 #include "UnboundedRegExpEpsilon.h"
 #include "../formal/FormalRegExpEpsilon.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -83,4 +84,10 @@ void UnboundedRegExpEpsilon::computeMinimalAlphabet( std::set<alphabet::Symbol>&
 
 }
 
+UnboundedRegExpEpsilon::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
index 50c45e81673e46c8fe83632133bd8dc64d5176d5..df1c9205c42cfb6a6d4c942c494c58d6e5cb5341 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h
@@ -68,6 +68,11 @@ public:
 	 */
 	virtual void operator>>(std::ostream& out) const;
 
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<UnboundedRegExpEpsilon>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp
index 78e07bdc101341a3fc85f6af526316adf02af56b..e2f9d5cf20b6aba2adf851ebe4de4432884f9874 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.cpp
@@ -9,6 +9,7 @@
 #include "../../exception/AlibException.h"
 
 #include "../formal/FormalRegExpIteration.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -130,5 +131,11 @@ void UnboundedRegExpIteration::computeMinimalAlphabet( std::set<alphabet::Symbol
 	element->computeMinimalAlphabet(alphabet);
 }
 
+UnboundedRegExpIteration::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
index afa05a74150006437b7e985da2eb3a91155cf5b8..55b53447b360e77d5e0debe9a0977ad8faee3547 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h
@@ -93,6 +93,12 @@ public:
 	virtual void operator>>(std::ostream& out) const;
 
 	friend class RegExpOptimize;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<UnboundedRegExpIteration>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp
index 9cfafbf4f18b5b1ecc8cb62a77f58bd18cf381d8..77f399bead390fa8b8657a779f34611fc6be7f56 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.cpp
@@ -7,6 +7,7 @@
 
 #include "UnboundedRegExpSymbol.h"
 #include "../formal/FormalRegExpSymbol.h"
+#include <sstream>
 
 namespace regexp {
 
@@ -121,5 +122,11 @@ const alphabet::Symbol& UnboundedRegExpSymbol::getSymbol() const {
 	return this->symbol;
 }
 
+UnboundedRegExpSymbol::operator std::string() const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace regexp */
 
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
index 858b8b4f61b2fdaa9fd047ec861994bd02bb8d9f..d0c08c69e4a3945a98bc608f8f654a3cb39592d8 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h
@@ -82,6 +82,12 @@ public:
 	 * Returns the string representation of RegExp Symbol.
 	 */
 	const alphabet::Symbol& getSymbol() const;
+
+	virtual operator std::string() const;
+
+	virtual int selfTypeId() const {
+		return typeId<UnboundedRegExpSymbol>();
+	}
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/std/visitor.hpp b/alib2data/src/std/visitor.hpp
index 4a471db8927a8269c3715fd1a650b9dfc7065e79..cf6119f0b14cb5df831fc9d7c905aa483b4c0d26 100644
--- a/alib2data/src/std/visitor.hpp
+++ b/alib2data/src/std/visitor.hpp
@@ -65,6 +65,7 @@ struct const_promoting_helper<Tested, Other...> {
 			typename std::enable_if< std::is_constructible<Desired, Tested>::value >::type* = nullptr >
 	inline static bool tryPromote(void* userData, const Desired& first, const Base& second, const TargetVisitor& visitor) {
 		if(dynamic_cast<const Tested*>(&second)) {
+		//if(Tested::template typeId<Tested>() == second.selfTypeId()) { //TODO on g++-4.9 uncomment
 			visitor.Visit(userData, first, Desired(static_cast<const Tested&>(second)));
 			return true;
 		} else {
@@ -133,6 +134,7 @@ public:
 	template<typename R>
 	void Visit1(void* userData, const T& first, const R& second) const {
 		if(dynamic_cast<const T*>(&second)) {
+		//if(T::template typeId<T>() == second.selfTypeId()) { //TODO on g++-4.9 uncomment
 			this->Visit(userData, first, static_cast<const T&>(second));
 		} else {
 			throw std::logic_error("Same visitor: Visited types are different.");
@@ -153,6 +155,7 @@ public:
 	template<typename R>
 	void Visit1(void* userData, const T& first, const R& second) const {
 		if(dynamic_cast<const T*>(&second)) {
+		//if(T::template typeId<T>() == second.selfTypeId()) { //TODO on g++-4.9 uncomment
 			this->Visit(userData, first, static_cast<const T&>(second));
 		} else {
 			throw std::logic_error("Same visitor: Visited types are different.");
diff --git a/alib2data/src/string/CyclicString.h b/alib2data/src/string/CyclicString.h
index 8c641dc4dae89177a93f3e509f69c3afbee5b55d..61e5b8851bdc0c3f602d6e968a8bf0cab13e6b62 100644
--- a/alib2data/src/string/CyclicString.h
+++ b/alib2data/src/string/CyclicString.h
@@ -67,7 +67,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<CyclicString>();
 	}
 };
 
diff --git a/alib2data/src/string/Epsilon.h b/alib2data/src/string/Epsilon.h
index 3d478256f79a5aedb5f225bc7b05c19997861e8e..bf39c0cf98bb90c09f6ce85c464f5cff13683023 100644
--- a/alib2data/src/string/Epsilon.h
+++ b/alib2data/src/string/Epsilon.h
@@ -59,7 +59,7 @@ public:
 	static Epsilon EPSILON;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Epsilon>();
 	}
 };
 
diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h
index 82395fbf5b6415e6a9d6ecc97ca96f6382d61c83..914386b1e3231767843c743c738e663c8c3257f7 100644
--- a/alib2data/src/string/LinearString.h
+++ b/alib2data/src/string/LinearString.h
@@ -75,7 +75,7 @@ public:
 	virtual operator std::string() const;
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<LinearString>();
 	}
 };
 
diff --git a/alib2data/test-src/std/StdVisitorTest.cpp b/alib2data/test-src/std/StdVisitorTest.cpp
index 073c523d34afcbff41af70a83f0cc66f4e979bdc..dbd7e2cedbb4c12f0a95586342f1a4298e458a16 100644
--- a/alib2data/test-src/std/StdVisitorTest.cpp
+++ b/alib2data/test-src/std/StdVisitorTest.cpp
@@ -73,7 +73,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Tmp1>();
 	}
 
 	int getData() const {
@@ -130,7 +130,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Tmp2>();
 	}
 
 	double getData() const {
@@ -191,7 +191,7 @@ public:
 	}
 
 	virtual int selfTypeId() const {
-		return typeId(*this);
+		return typeId<Tmp3>();
 	}
 
 	const std::string& getData() const {