Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-12-10 13:13:58


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Tuesday, December 10, 2002 9:24 AM
Subject: Re: [boost] Re: Formal review: Optional library

> From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> > Considering a member function that returns a pointer to something that
is
> > inside an object -a typical 'get()'-, it was noticed that most of the
> times,
> > it is not clear how the lifetime of the returned object is supposed to
be
> > handled.
> [...]
> > (b) in other cases, the object is being handed out through the pointer
and
> > there is some sort of ownership transfer or distribution involved.
>
> Example?
>
I don't know of 'standard' examples, but in my code I do that a lot:

class curve
{
  shared_ptr<polygon> acquire_approx() const { return m_approx ; }
  shared_ptr<polygon> m_approx ;
} ;

Fernando Cacciola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk