lundi 23 mai 2016

Define variable b of the same type as variable a

Is it possible (using type traits) to declare a variable var_b of the same type as another variable, var_a has?

For example:

template <class T>
void foo(T t) {

   auto var_a = bar(t);
   //make var_b of the same type as var_a

}


F_1 bar(T_1 t) {

}

F_2 bar(T_2 t) {

}

Aucun commentaire:

Enregistrer un commentaire