New in this month's Overload magazine:
by Andreas Fertig
From the article:
... What I have illustrated is that there is an issue with range-based
for-loops. In (1), we call
GetKeeper().items()in the head of the range-based
for-loop. By doing this, we create a dangling reference.
ref-qualifiers to the rescue
Now, this brings us to ref-qualifiers. They are often associated with
movesemantics, but we can use them without
move. However, we will soon see why ref-qualifiers make the most sense with
A version of
Keeperwith ref-qualifiers looks like Listing 2...