Marco Foco shows different solutions and tradeoffs to a dangling reference problem:
Optimizing return values
by Marco Foco
From the article:
As you can see, class C contains a function
get()
which returns a reference to its internal state. In normal code, we must take care not to use this reference after our class has been destroyed...
Add a Comment
Comments are closed.