lundi 23 août 2021

C++ Conditional typedef with more than two type

I am trying to do something like this .

if (flow1)
  {
     typedef template_class<user_defined_type1> x;
  }
else if (flow2)
  {
     typedef template_class<user_defined_type2> x;
  }
else if (flow3)
  {
     typedef template_class<user_defined_type3> x;
  }
else 
  {
     typedef template_class<user_defined_type4> x;
  }

I checked the answers for this question How to make a conditional typedef in C++ but I'm not sure how I can use std::conditional if I have more than 1 type ? Is it even possible to do something like this ?

Aucun commentaire:

Enregistrer un commentaire