Hi,

I have a simple question on trying to set shared ptr to NULL.

I get an error(binary '=': no operator found which takes a right hand operand of type 'int') when I do this...

typedef std::tr1::shared_ptr<A> A_smrt;
A_smrt = NULL;

Why is this wrong?

Actually there is no need to initialise it to NULL as we do in case of normal pointers.
How ever, for more info, you can refer to the boost library docs.

Cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.