Since rects is now outside the for loop, you can safely convert it to a reference:
CompRect::vector &rects (rem.rects ());
Then it becomes a reference to a temporary that is not destroyed till the end of the block/function. And that way only 2 temporary vectors are created (one inside rects() and one outside). In its current form, 3 temporary vectors could be created. Though its possible gcc will sometimes optimize that to 2...
Since rects is now outside the for loop, you can safely convert it to a reference:
CompRect::vector &rects (rem.rects ());
Then it becomes a reference to a temporary that is not destroyed till the end of the block/function. And that way only 2 temporary vectors are created (one inside rects() and one outside). In its current form, 3 temporary vectors could be created. Though its possible gcc will sometimes optimize that to 2...