mercredi 17 février 2021

Shortcuts for repeated template arguments

Let's say I have a class:

template <typename A, typename B, typename C>
class Foo {
};

in which usually A and B are the same type, but I'd like to keep the option to define B separately. I'd like to define an additional template, say,

template <typename A, typename C>
class Foo {
};

that is just a wrapper for Foo<A, A, C>. Is this common practice? If so, what's the simplest way to do it?

Aucun commentaire:

Enregistrer un commentaire