Boost logo

Boost Users :

From: Jonathan Franklin (franklin.jonathan_at_[hidden])
Date: 2006-07-17 17:51:31


On 7/16/06, Delfin Rojas <drojas_at_[hidden]> wrote:
>
> template <class U>
> class P
> {
> public:
> template <class V>
> P(V * v) : u(v) {}
>
> private:
> U *u;
> };
>
> Now "P<CMutex> p1(0);" will not compile but "P<CMutex> p1(new CMutex);"
> will.
>

I believe this is due to the fact that in C++ it is illegal for the compiler
to do more than one implicit cast. In this case it would have to implicitly
cast from <int>(0) to <V *>(0) and then implicitly cast again from <V *>(0)
to <U *>(0).

Jon



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net