In this question the OP asked for a solution to template typedef which is not possible in C++. The OP also presented a solution themselves but did not like it:
template<size_t N, size_t M>
class Matrix {
// ....
};
// Problem - will not compile
typedef Matrix<N,1> Vector<N>;
// Solution
template <int N>
class Vector: public Matrix<N,1>
{ };
My question is, what advantage does the Helper::type
solution give us over the OP's solution (assuming these classes are never meant to be used by a base pointer or new
'd as such)? An empty class should carry no overhead in release (or does it?). The only disadvantage I can see is that in debug builds you will have to expand the base class when debugging.
EDIT: In addition to the selected answer, see @Dani's answer who suggested that the inherited version would require constructors to be defined, which is an added inconvenience.