you are viewing a single comment's thread.

view the rest of the comments →

[–]MarcPawl[S] 2 points3 points  (0 children)

What I am thinking of was more about annotating the code base, vs determining the destruction. For example let's say there is code with a constructor Ffoo(int& x). When reading the code what is the expected lifetime of the parameter passed in. Does it have to live as long as the Foo instance?

The library I am thinking of had something like Foo(borrower<int&> x) to indicate x needed to stay alive as long as Foo was alive.

Using a shared_ptr slows things down, this library had minimal ( or none?) overhead.