Boost logo

Boost Users :

Subject: Re: [Boost-users] Cyclic includes when using smart pointers.
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-03-31 12:42:43


Jared Lee Richardson:
> Oh ok, now I feel dumb. :(
>
> I thought that because it was a template, I couldn't forward declare it
> because the template would need information about the class.

No need to feel dumb; most smart pointers do not support this use, but
shared_ptr does. You can even do things like

class X;

shared_ptr<X> f( bool b, shared_ptr<X> p, shared_ptr<X> q )
{
    return b? p: q;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net