I have the following simple strinToTypeImpl
function which converts any kind of string into the template type. The problem I am concerned about is the fact that the
Kerreck's answer and my comment there explain the problem. There is no way for the type system to map a member to a parent-of-member, so the ::
operator stops the deduction process which needs to match T
.
The simple way to a solution would be to bring Vector3
outside and specialize it on the matrix type, then make the member MyMatrix< T >::Vector3
a typedef.
template< typename Matrix >
struct Vector3 {
typename Matrix::ValueType x, y, z;
};
template< typename T >
struct MyMatrix {
typedef Vector3< MyMatrix > Vector3;
};
The partial specialization of StringToTypeImpl
needs to be on the final template type, not the typedef. Partial specialization cannot match across a set of typedefs, although specialization can match type to the type aliased by a single typedef name.