[Development] std::allocate_shared for QSharedPointer

Sean Harmer sean.harmer at kdab.com
Sat Sep 9 13:03:01 CEST 2017


On Saturday, 9 September 2017 11:54:14 BST Giuseppe D'Angelo wrote:
> Il 09/09/2017 10:46, Sean Harmer ha scritto:
> > Does anybody have any plans to add such a facility? Or is there some
> > other facility to avoid operator new here for both the QSP and the
> > object itself?
> 
> Just go ahead and use std::allocate_shared, or is it in public APIs? Any
> such improvement to QSharedPointer at this point is really a waste of time.

The QSharedPointers are used in the public API as we can't use std::shared_ptr 
there. I guess the closest I can get without such a facility is to maintain a 
pool of QSharedPointers, a pool of the objects and use QSharedPointer::reset() 
when recycling or just keep the two pools in sync whcih I guess makes sense 
anyway.

Cheers,

Sean
-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts



More information about the Development mailing list