New in this month's Overload magazine:
The power of ref-qualifiers
by Andreas Fertig
From the article:
... What I have illustrated is that there is an issue with range-based
for-loops. In (1), we callGetKeeper().items()in the head of the range-basedfor-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 withoutmove. However, we will soon see why ref-qualifiers make the most sense withmovesemantics.A version of
Keeperwith ref-qualifiers looks like Listing 2...

Add a Comment
Comments are closed.