But consider the following code:
#include<iostream>
using namespace std;

class CMutex{};//Hide all the implementations for convience

template<class Y>
void world(Y * p)
{
      
}

void hello(int *x){
   
}

int main(){
    hello(0);
    world<CMutex>(0);
    return 1;
}
It compiles and runs without problems.So you see I can pass zero as a pointer to Y, and as a pointer to int. That's OK.
I wonder how it is implemented that we cannot pass zero as a pointer to Y in the constructor of shared_ptr.

Thanks
Zhuo Hao


On 14/07/06, Tommy Hinks < tommy.hinks@gmail.com> replied:
You can't pass 0 because the Type passed must be an Investment*, not
just a type that could be cast to one. This is why you have to
explicitly cast it yourself.