0

We want in our code base to hide the implementation from the header files and therefore include them only in cpp files. However, on many occasions we have template classes/functions. Now, for example we got around 100 different classes which all are templated, and the only valid usage is when the template argument is either class_a, class_b and class_c.

These "100" different classes either contain template member functions or they are themselves templated. E.g.

 class_1
 { 
   template<typename T> 
   class_1(){ .... } 

 } 

or

 template<typename T>
 class_2{ ...}

Where T needs to be instantiated for a specific number of classes. Is there an automatic and more maintainable way to register each of those 100 classes by saying something like please instantiate all found template functions with the following template arguments rather than going to each one of them and doing it manually. Is there a c++ design pattern that deals with such scenarios.

rturrado
  • 7,699
  • 6
  • 42
  • 62
ATK
  • 1,296
  • 10
  • 26

0 Answers0