lundi 31 août 2020

Variadic Template Expansion - expand all except the i-th entry

Is there a way to remove one of the types from type expansion?

Let's use tuple as an example,

void foo() {
     tuple<int, double, string> t;
     // some facility to expand except the i-th type:
     expand_except_ith<0>(t);   // returns tuple<double, string>
     expand_except_ith<1>(t);   // returns tuple<int, string>
}

Aucun commentaire:

Enregistrer un commentaire