Possible Duplicate:
Why is the template argument deduction not working here?
Workaround for non-deduced context
Consider the following code:
template<typename T>
struct S
{
struct I
{
T t;
};
};
template<typename T>
std::ostream& operator<<(std::ostream& out, const typename S<T>::I& i)
{
out << i;
return out;
}
int main()
{
S<int>::I i;
std::cout << i;
}
This code fails in Visual Studio 2010, as the << operator cannot be found. Is it possible to create an output operator for S::I?