← Back to team overview

dolfin team mailing list archive

Re: Checking if shared_ptr is NULL

 

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, and
initialization to zero should be handled by

_foo = shared_ptr<foo>();

--
Anders



Follow ups

References