vendredi 26 février 2016

c++11 -Template MetaProgramming - Error: template parameters not used in partial specialization

i am getting stuck with a partial template implementation, the idea is to provide a class (a builder) that is select at compile time using an enum class definition, also i want to provide the name of file and a class name for manage from the factory singleton. But this is not compiling, i am trying several hours, but i cannot see what i am doing wrong. This is the code:

enum class BuildersType
{
   ComunicationBuilder
};

//class definition
template<BuildersType, class ... Args>
class BuiderType;

//class implementation
template<const char * const FILENAME , const char *  const CLASSNAME, class ClassToConfigurate>
class BuiderType<BuildersType::ComunicationBuilder,const char * const ,const char * const ,ClassToConfigurate>
{
   public:

};

template<const char * const FILENAME , const char * const CLASSNAME>
class AnotherBuilder
{
};

namespace Test
{
   static constexpr char FILENAME []="aFileName";
   static constexpr char  CLASSNAME []="ClassName";
   class TestClass{};
}

int main()
{

   BuiderType<BuildersType::ComunicationBuilder,Test::FILENAME,Test::CLASSNAME,Test::TestClass> aBuilder;
   AnotherBuilder<Test::FILENAME,Test::CLASSNAME> aAnotherBuilder;
   return 0;
}

The compile ouput :

Error: template parameters not used in partial specialization:
 class BuiderType<BuildersType::ComunicationBuilder,const char * const ,const char * const ,ClassToConfigurate>
       ^
main.cpp:14:7: error:         'FILENAME'
main.cpp:14:7: error:         'CLASSNAME'

At this hours i am really tired, and i am asking help. Thx in advance

Aucun commentaire:

Enregistrer un commentaire