
Sebastian Redl <sebastian.redl@getdesigned.at> wrote:
If this is implemented as I guess it is, you might also suffer from the not clearly defined temporary destruction semantics.
I think that concept of accessors will work correctly with any optimization of temporary object returning. In case if no optimization applied copy constructor will be invoked (maybe even several times) but recursive mutex will handle this situation. In case if any optimization applied compiler will destroy any object after it becomes inaccessible (just after expression where temporary object is created and used). So we have only two kinds of situations: either we have some accessor object (it can be temporary, automatic, dynamic or any other) resource is locked and we can access it, or we have no accessor objects, resource is unlocked and we can access it only by creation accessor. Am I right or it is possible on a single compiler that some object destroys not exactly after it becomes inaccessible? --- With respect, Vladimir Frolov