russ@haydon449.plus.com wrote:[color=blue]
> Been looking at some code.....
> [...]
> template < typename T >
> std::ostream & operator<< ( std::ostream & os, const typename A<T>::B[/color]
'const typename A<T>::B &' is not one of the forms which the Standard
allows for template argument deduction from a function argument. So,
the compiler simply fails to deduce 'T' here, most likely.
[color=blue]
> & b )
> [...]
>
> Is that standard conforming?[/color]
I don't think so.
[color=blue]
> Should it work fine as is?[/color]
I don't think so.
[color=blue]
> My copy of MSVC 7.0 doesn't complain but Comeau's online beta says no
> and fails when -tused is used.
> If this is not supposed to work then why is that and what is the best
> way of rewriting it?[/color]
Why should 'B' be inner to A<T>? Perhaps you should make 'B' a template
as well? The only work-around I can think of is to make 'B' a class not
nested in 'A<T>' but a separate class.
V