I'm using reset() as a default value for my shared_pointer (equivalent to a NULL).
reset()
NULL
But how do I check if the shared_pointer is NULL?
Will this return the right value ?
boost::shared_ptr<Blah> blah; blah.reset() if (blah == NULL) { //Does this check if the object was reset() ? }
if blah == NULL will work fine. Some people would prefer it over testing as a bool (if !blah) because it's more explicit. Others prefer the latter because it's shorter.
if blah == NULL
if !blah