how to check auto_ptr is already pointing to an object or not

107 Views Asked by At

I currently have an auto_ptr:

auto_ptr<ClassA> classA_;

How can I check whether classA_ points to something or not. If I do:

if (classA_ == NULL)

to check if its pointing to NULL, it is giving a compile error: error: no match for 'operator==' in 'classA_ == 0'

Thank you.

1

There are 1 best solutions below

0
On BEST ANSWER

What about

classA_.get() == 0

?