| re: Problem with template ctors (smart pointer)
On Thu, 17 Jun 2004 13:42:12 +0400, Vladimir Prus wrote:
[color=blue]
>gcc 2.72 ?! You really have to upgrade. Get at least 2.95, or better 3.4, or
>you'll have a number of problems with standard compilance.[/color]
I would like to, but it's not possible because in my customer says
i MUST use this compiler.
[color=blue]
>gcc 3.3 has no problem with the above, except that ctor 4 should take const
>reference.[/color]
Same as Sharad suggested (for ctor 3).
With a few changes in my code it works now.
[color=blue]
> The syntax used in
>
> Pointer<A> p4 = p2; // error
>
>is called copy-initialization. Since p2 is of type Pointer<B>, the compiler
>creates temporary of type Pointer<A> (using ctor 3) and then tries to pass
>that temporary to copy ctor (ctor 4). The value created by ctor 3 is
>temporary, and can't be passed to ctor 4 unless it takes const reference.[/color]
Thanks for the explanation now i understand where the problem comes
from.
[color=blue]
>And again, upgrade your compiler.[/color]
I can't.
[color=blue]
>HTH,[/color]
Thank again you helped a lot, regards
Carsten
--
mail<AT>carsten-spiess.de |