You have a problem with a "non-deducible context" in this operator
template<typename T>
inline std::ostream& operator<< (std::ostream &out,
const typename classA<T>::classB &b)
{
return out;
}
The compiler cannot figure out what values of T
will result in a classB
that matches the parameter you want to pass. So this template is not considered!
In C++11 mode, the compiler then goes on to find a close match from the standard library
operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&)
where it can match _Tp
to just about any type, including classA<T>::classB
, but notes that the first parameter doesn't match.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…