| re: How to Call Templatise function of class
Peter Koch Larsen wrote:[color=blue]
> "Victor Bazarov" <v.Abazarov@comAcast.net> skrev i en meddelelse
> news:%rkle.77130$NC6.7620@newsread1.mlpsca01.us.to .verio.net...
>[color=green]
>>Peter Koch Larsen wrote:
>>[color=darkred]
>>>
>>>I see nothing wrong with your code. Perhaps you're using an ancient
>>>compiler - VC++ 6.0 might well have problems here.[/color]
>>
>>I can see that at least the class 'NULLPointer' definition does not end
>>with a semicolon. That makes the code as posted ill-formed.[/color]
>
>
> Right - didn't notice that. Apart from this the code is ok, however.[/color]
Uh... Well... The inclusion of <iostream> is not necessary and 'using
namespace std' is not terminated with a semicolon as it should be. If
I remove those, add the semicolon after the class definition, then it
should compile, yes.
VC++ v6 has lots of problems with member templates. One of them is the
actual cause of the OP's troubles IMO: VC++ v6 requires a member template
to have a typed argument to deduce a template argument from it. Since
conversion operators don't have any arguments (except 'this'), VC++ v6
fails to deduce that T should be 'char'.
It works in VC++ v7.1. To the OP: upgrade!
V |