diff --git a/alib2data/src/string/common/StringAuxiliary.cpp b/alib2data/src/string/common/StringAuxiliary.cpp index 0ee5d1acdd2a3bf1460733ed59f2d3667229155a..3ed220ee395ce08d7e370ca75a8c936a4805f593 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 f5bec64bf9614f44b0a39769af8fcf920fd13a89..26dd458d8c77273ce4166cb231ad8ac118c39264 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_ */