This needs to be handled a bit carefully, because Qt containers
will detach upon being iterated over using range-for.
In the cases of this patch, that trivially cannot happen, because
all containers are marked as const when being assigned the rvalues
previously found on the rhs of the Q_FOREACH. The new code thus
does exactly what the old code did: take a const copy, then iterate
over it.
Separate patches will deal with other situations.
Range-for loops are much more efficient than foreach loops.
This patch shaves almost 4K of text size off an optimized Linux
AMD64 GCC 4.9 build.
Change-Id: Ida868b77d078cbfa0516d17e98e6f0a86fcdb7a3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>