I was trying to solve a problem, but found a different solution. however out of curiosity like to know if the following is possible:
template< class > struct S;
template< > struct S< Foo > : struct< Foo > {};
I would like to be able to inherit nonspecialized struct from specialized struct.the example above does not work because the inherited struct is the specialized, leading to the infinite recursion.
One possible solution was to add second template parameter, say bool specialized, such that the default is false, and specialized template has that parameter is true.however that makes things a bit messy since instantiation needs to specify additional parameter.
Is there some other way around to implement the above?
the original problem was to implement matrix of matrixes, where matrix itself may have additional operators, depending if the constituent matrixes has those operators.I would hope that makes sense. at the same time different specialized matrix need to be of the same base class at the same time retaining the same name, although with different template parameters. I have thought there might be a way to do it using enable_if and type traits