[Development] The future of smart pointers in Qt API

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Feb 1 00:46:10 CET 2020


On 31/01/2020 23:46, Vitaly Fanaskov wrote:
> I'd suggest QUniquePointer. Honestly, I don't think we have too many alternatives here. We can try Rust-like naming (something like QBox), but it just looks weird and tells nothing about ownership semantics.
> 
> After that we can write "using QScopedPointer = QUniquePointer" 

The consensus was reached against such a decision. A scoped pointer 
should not be able to escape scope. Yes, in C++17 this is now not 
entirely true, but the name strongly implies it.

About QUniquePointer: what's the point of reinventing std::unique_ptr 
under a different name?

* Is it just going to be an alias, to be more Qtish? Then why 
QSharedPointer is NOT going to be an alias?

* Is it not going to be an alias? NIH all over again?

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200201/dc0fd248/attachment.bin>


More information about the Development mailing list