Boost logo

Boost :

From: Andy Glew (glew_at_[hidden])
Date: 2000-01-06 22:01:07


Aleksey has quoted chapter and verse at me
to persuade me that using
    mobj->method()
to return a temporary (e.g. auto_lock)
has minimum and maximum guarantees on the lifetime
of the temporary - specifically, that the temporary return value
is guaranteed to be released at the end of the "full expression",
and not before.

This is bloody wonderful!

Using this trick, you can write arbitrary pre and post code
around any access to an object proxied using ->.

Not only does it mean that auto_ptr<T> can safely be used
in expressions (which I probably should have known), but it
also allows:
    * implicit locking, as we did here
    * persistence ---- Q: if this is a well known trick, then
why haven't I seen persistence libraries implemented this
way? Or, have I just been looking in the wrong places?
    * compression, decompression
    * usage monitoring, performance monitoring
    


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk