[Development] Making QScopedPointer scoped (again)

André Somers andre at familiesomers.nl
Tue Sep 3 11:42:10 CEST 2013


Op 3-9-2013 11:31, Oswald Buddenhagen schreef:
> On Tue, Sep 03, 2013 at 10:02:52AM +0200, Stephen Kelly wrote:
>> Again, this is what std::unique_ptr is for. We should not try to turn
>> QScopedPointer into an attempt at a NIH std::unique_ptr. Where people have a
>> need for a std::unique_ptr, they should use it. We should not adapt
>> QScopedPointer to fit the need instead.
>>
> why exactly would such a dual-use scoped pointer be a problem? anything
> else than dogmatism?
>
Because it breaks what QScopedPointer is trying to do for you. If you 
want something that you can return, there are other alternatives around 
like the mentioned std::unique_ptr or even QSharedPointer if you fancy. 
Outfitting QScopedPointer with methods that allow you to break out of 
the scope means that you can't rely on that core feature anymore.

André

-- 
You like Qt?
I am looking for collegues to join me at i-Optics!




More information about the Development mailing list