[Development] How qAsConst and qExchange lead to qNN

Thiago Macieira thiago.macieira at intel.com
Mon Nov 14 22:17:21 CET 2022


On Monday, 14 November 2022 12:53:19 PST Marc Mutz via Development wrote:
> > I don't think we will ever change return types.
> 
> Your short interjections would be more valuable if you didn't just state
> an opinion, but also give rationale ;-)

That's why I said "I think".

We can't return a non-owning view because that requires that we store 
internally *as* a contiguous area. If we are already doing that, we can store 
as QList and return *as* QList with implicit sharing.

Returning as an iteratable interface requires that we return a proxy object, 
like QRegularExpressionMatch, so that the solution is thread-safe. This is 
neither simple to understand, to code, or to port existing code over to. It 
also requires copying the data over (hopefully, implicitly) to the proxy 
object, so it doesn't solve anything.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering





More information about the Development mailing list