I am improving my template math library and I came upon the following problem:
typedef std:size_t Size;
template < typename T >
class A
{
public:
template < Size x >
class B
{
T asdf[x];
};
};
template < typename T, Size x >
inline A<T> operator + ( T value, const typename A<T>::template B<x>& vec )
{
return A<T>();
}
int main( int argc, char** argv )
{
A<Float>::B<2> b;
5.0f + b; // ERROR: match for operator not found
}
For some reason the + operator is not found by the compiler. If i remove the first template argument from the operator (typename T) and explicitly use a type like float instead, the operator is found just fine.
Any idea how to work around this limitation? Note: B must be within the scope of A because both classes need the concrete type of the other.