Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-03-21 12:28:17


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> David Abrahams
> Sent: Tuesday, March 21, 2006 4:25 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] how to use shared_ptr to wrap
> std::vector andreturnfrom function?
>
> "Sohail Somani" <s.somani_at_[hidden]> writes:
>
> >> -----Original Message-----
> >> From: boost-users-bounces_at_[hidden]
> >> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> >> kdsfinger_at_[hidden]
> >> Sent: Monday, March 20, 2006 9:59 AM
> >> To: Boost-users_at_[hidden]
> >> Subject: [Boost-users] how to use shared_ptr to wrap
> >> std::vector and returnfrom function?
> >>
> >> hi, Boost users
> >>
> >> Suppose I created a large data in a function and want to
> >> return it back to where the function was called. I want to
> >> return the pointer so that the deep copy of the large data is
> >> not needed and memory leak is nicely handled. Can someone let
> >> me know how to do it?
> >
> > This is what auto_ptr is for, shared_ptr is overkill as far as I can
> > tell
>
> unless you have to cross DLL boundaries, or you need a custom deletion
> routine, or a base class of the object pointed to might not have a
> virtual destructor, ...

As far as I can tell! Sheesh :)


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