[Development] How qAsConst and qExchange lead to qNN

Thiago Macieira thiago.macieira at intel.com
Tue Nov 15 17:33:15 CET 2022

On Tuesday, 15 November 2022 01:42:55 PST Marc Mutz via Development wrote:
> > 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.
> I disagree on all points. QREM is complicated because we need to
> shoehorn a coroutine into an iterator concept. Same with
> QStringTokenizer. Coroutines with lazy sequences (generator<>) are very easy
> to implement and use.
> If we're to discuss further, please watch my Meeting C++ presentation,
> which lays out all the pros and cons I'm aware of. No need to re-iterate
> them in text here. https://youtu.be/tvdwYwTyrig

It will take some time to watch it.

In the meantime, I'd appreciate a short answer on how you return the keys from 
a stored associative map, in a thread-safe manner (such that if something in 
the same thread or another thread-safely modifies that map, the original user 
isn't affected). Because you pointed to QStringTokenizer and that implicitly-
copies a QString.

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

More information about the Development mailing list