I tried to implement a template template template - a template class to fill my needs (I'm completely new in using template metaprogramming). Unfortunately, I found the following topic too late: Template template options
However, I need to implement something like the ones listed below.
According to the compiler, the last typedef does not work. I am not sure, but I think this is due to limiting the restriction of the three patterns. Is there any way around the definition of 3xtemplate in this simple example?
template < typename TValueType > class ITTranslator { public: ITTranslator() = 0; virtual ~ITTranslator() = 0; virtual void doSomething() = 0; } template < typename TValueType > class TConcreteTranslator1 : public ITTranslator<TValueType> { public: TConcreteTranslator1(){} ~TConcreteTranslator1(){} void doSomething() {} } template < typename TValueType > class TConcreteTranslator2 : public ITTranslator<TValueType> { public: TConcreteTranslator2(){} ~TConcreteTranslator2(){} void doSomething() {} } template < typename TValueType, template < typename TValueType > class TTranslatorValueType > class ITClassifier { public: ITClassifier() = 0; virtual ~ITClassifier() = 0; } template < typename TValueType, template < typename TValueType > class TTranslatorValueType > class TConcreteClassifier1 : public ITClassifier<TValueType,TTranslatorValueType > { public: TConcreteClassifier1() {} ~TConcreteClassifier1() {} void dodo(){} } template < typename TValueType, template <typename TValueType> class TTranslatorValueType, template <template<typename TValueType> class TTranslatorValueType> class TClassifierValueType > class ITAlgorithm { public: ITAlgorithm()=0; virtual ~TAlgorithm()=0; virtual run() = 0; } template < typename TValueType, template <typename TValueType> class TTranslatorValueType, template <template<typename TValueType> class TTranslatorValueType> class TClassifierValueType > class TConcreteAlgorithm1 : public ITAlgorithm<TValueType,TTranslatorValueType,TTranslatorValueType> { public: TConcreteAlgorithm1 (){} ~TConcreteAlgorithm1 (){} run() { TClassifierValueType< TTranslatorValueType>* l_classifier_pt = new TClassifierValueType< TTranslatorValueType>( );
Thank you very much, I really appreciate any help!
EDIT: I expanded my list (I'm sure it wonβt compile :)) to show the motivation why I use my weird concept :)
bobby source share