I have a class template with an explicit class template specialisation and another partial class template specialisation.
template< typename T1, typename T2 >
class A{
internal_representation1 inRep;
// methods
};
template<>
class A < specific_type_1,specific_type_2 >{
//internal represenation different for this type.
internal_representation2 inRep;
// methods
};
template< template T1 >
class A < T1,specific_type_2 >{
//internal represenation different for this type.
internal_representation3 inRep;
// methods
};
The specialisations leads to interface duplication. The class template and its specialisations all have the same method names but differ in their implementations.Specifically, the representation of their internal data structure.
Should I replace the above implementation with the bridge design pattern ?
note: This question is related to How can we implement the Builder design pattern using boost::mpl?