Boost logo

Boost Users :

From: ye_feng (yefeng_at_[hidden])
Date: 2002-07-04 21:19:43


don't forget to make "bool dismissed_" mutable, so that dismiss() can
change it for "typedef const scoped_guard_impl& scoped_guard"

Regards,
yefeng

--- In Boost-Users_at_y..., Jon Wang <webmaster_at_b...> wrote:
>
> >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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net