Re: [Boost-Users] ScopeGuard Implementation
4 Jul
2002
4 Jul
'02
1:35 a.m.
This solution won't work, because you are storing a reference to a temporary object, which will cease to exist after the constructor call. Then the destructor is accessing memory that has already been destructed and probably reused.
Sorry! A silly mistake here:-) Well, what I meant is typedef const scoped_guard_impl& scoped_guard; // not "typedef scoped_guard_impl& scoped_guard;" Then "a const reference initialized with a temporary value makes that temporary value live for the lifetime of the reference itself". Is this fine? Jon
8181
Age (days ago)
8181
Last active (days ago)
0 comments
1 participants
participants (1)
-
Jon Wang