jeudi 7 septembre 2017

Swap two parameters in variadic template

I'm trying to swap two items of a parameter pack.

Ideally, I would like to do something like this:

template<int i1, int i2, class... Args>
void swapped_copy(some_class a, some_class b, Args... args) {
    a(args...) = b(/* 'args...' where parameters with indices i1 and i2 are swapped */);
}

Any idea?

Many thanks.

Aucun commentaire:

Enregistrer un commentaire