← Back to team overview

dolfin team mailing list archive

Re: Checking if shared_ptr is NULL

 


On 01/02/11 21:46, Anders Logg wrote:
> On Tue, Feb 01, 2011 at 01:36:59PM -0800, Johan Hake wrote:
>> On Tuesday February 1 2011 13:18:54 Anders Logg wrote:
>>> What is the correct way to check whether a shared_ptr is NULL?
>>
>> What with:
>>
>>  bool has_child() const
>>  {
>>    return _child.count()!=0;
>>  }
> 
> Will try that.
> 
>> or just or implement a constructor for Hierarchical which initialize the
>> shared_ptr to 0?
> 
> I was under the impression it's always initialized to 0, 

That's true.

Garth

and
> initialization to zero should be handled by
> 
> _foo = shared_ptr<foo>();
> 
> --
> Anders
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References