I have a class definition with 3 template parameters. I would like to create specializations of this class with specific combinations of 2 of the parameters, leaving the third free. How can I do that without duplicating code?
template < typename A, typename B, class C> Foo{}; // only defining particular specializations
template<class C> Foo<int, float, C>
{
int V1;
float V2;
friend C;
/* implementation using V1, V2 */
}
template<class C> Foo<bool, char, C>
{
bool V1;
char V2;
friend C;
/* duplicate implementation using V1, V2 */
}
main {
Foo<bool, char someclassname> fbc;
Foo<int, float, otherclassname> fif;
}