From bed4c5084fc70a9eac295d39cbb724d804f10443 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Thu, 1 Dec 2016 10:53:23 +0100
Subject: [PATCH] template some parts of StringAuxiliary

---
 .../src/string/common/StringAuxiliary.cpp     | 13 -----------
 alib2data/src/string/common/StringAuxiliary.h | 22 +++++++++++++++++--
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/alib2data/src/string/common/StringAuxiliary.cpp b/alib2data/src/string/common/StringAuxiliary.cpp
index 0ee5d1acdd..3ed220ee39 100644
--- a/alib2data/src/string/common/StringAuxiliary.cpp
+++ b/alib2data/src/string/common/StringAuxiliary.cpp
@@ -6,7 +6,6 @@
  */
 
 #include "StringAuxiliary.h"
-#include "../../alphabet/RankedSymbol.h"
 
 namespace string {
 
@@ -18,16 +17,4 @@ std::vector < alphabet::Symbol > StringAuxiliary::toInternal ( const std::string
 	return data;
 }
 
-std::vector < alphabet::Symbol > StringAuxiliary::wrapSymbols ( const std::vector < std::ranked_symbol < > > & ranked ) {
-	return std::transform < alphabet::Symbol > ( ranked, [&] ( const std::ranked_symbol < > & symbol) {
-			return alphabet::Symbol ( alphabet::RankedSymbol < > ( symbol ) );
-	} );
-}
-
-std::set < alphabet::Symbol > StringAuxiliary::wrapSymbols ( const std::set < std::ranked_symbol < > > & ranked ) {
-	return std::transform < alphabet::Symbol > ( ranked, [&] ( const std::ranked_symbol < > & symbol) {
-			return alphabet::Symbol ( alphabet::RankedSymbol < > ( symbol ) );
-	} );
-}
-
 } /* namespace string */
diff --git a/alib2data/src/string/common/StringAuxiliary.h b/alib2data/src/string/common/StringAuxiliary.h
index f5bec64bf9..26dd458d8c 100644
--- a/alib2data/src/string/common/StringAuxiliary.h
+++ b/alib2data/src/string/common/StringAuxiliary.h
@@ -12,6 +12,7 @@
 #include <vector>
 #include "../../alphabet/Symbol.h"
 #include "../../alphabet/ranked_symbol.hpp"
+#include "../../alphabet/RankedSymbol.h"
 
 namespace string {
 
@@ -21,10 +22,27 @@ namespace string {
 class StringAuxiliary {
 public:
 	static std::vector < alphabet::Symbol > toInternal ( const std::string & rawString );
-	static std::vector < alphabet::Symbol > wrapSymbols ( const std::vector < std::ranked_symbol < > > & ranked );
-	static std::set < alphabet::Symbol > wrapSymbols ( const std::set < std::ranked_symbol < > > & ranked );
+
+	template < class SymbolType, class RankType >
+	static std::vector < alphabet::Symbol > wrapSymbols ( const std::vector < std::ranked_symbol < SymbolType, RankType > > & ranked );
+	template < class SymbolType, class RankType >
+	static std::set < alphabet::Symbol > wrapSymbols ( const std::set < std::ranked_symbol < SymbolType, RankType > > & ranked );
 };
 
+template < class SymbolType, class RankType >
+std::vector < alphabet::Symbol > StringAuxiliary::wrapSymbols ( const std::vector < std::ranked_symbol < SymbolType, RankType > > & ranked ) {
+	return std::transform < alphabet::Symbol > ( ranked, [&] ( const std::ranked_symbol < SymbolType, RankType > & symbol) {
+			return alphabet::Symbol ( alphabet::RankedSymbol < SymbolType, RankType > ( symbol ) );
+	} );
+}
+
+template < class SymbolType, class RankType >
+std::set < alphabet::Symbol > StringAuxiliary::wrapSymbols ( const std::set < std::ranked_symbol < SymbolType, RankType > > & ranked ) {
+	return std::transform < alphabet::Symbol > ( ranked, [&] ( const std::ranked_symbol < SymbolType, RankType > & symbol) {
+			return alphabet::Symbol ( alphabet::RankedSymbol < SymbolType, RankType > ( symbol ) );
+	} );
+}
+
 } /* namespace string */
 
 #endif /* STRING_AUXILIARY_H_ */
-- 
GitLab