samedi 20 octobre 2018

conditional member function declaration based on variadic template length

I want to define a different set of member functions in my class based on the length of the class's variadic template. Is this possible? For example is something like this possible?:

template<class T, std::size_t... T2>
class{
   public:
      #ifdef SIZE_OF_T2_GREATER_THAN_ZERO
         void f1(params1);
      #else
         void f2(params2);
      #endif
}

So if the length of T2 is greater than zero I want function f1 defined while if there are no parameters in T2 I want some function f2 defined. Is this possible? Thanks

Aucun commentaire:

Enregistrer un commentaire