Boost logo

Boost :

Subject: Re: [boost] Severe shared_ptr limitation WRT dynamically loaded libraries
From: Ulrich Eckhardt (doomster_at_[hidden])
Date: 2008-11-23 04:43:14

On Thursday 20 November 2008 14:23:49 Jens Finkhäuser wrote:
> If you're talking workarounds, here's another one: why return
> shared_ptr at all? If it's a factory you're implementing (i.e.
> something that creates objects, and doesn't hold references to them),
> there's little reason to return one.
> Return a raw pointer, and build a shared_ptr from the return value.

I would have said the same, but IMHO it should return std::auto_ptr instead.
In cases where it returns a derived type, splitting into a public, nonvirtual
function returning auto_ptr<BaseT> and a pure virtual one that can then
support covariant return types is a suitable solution.


Boost list run by bdawes at, gregod at, cpdaniel at, john at