Boost logo

Boost Users :

Subject: Re: [Boost-users] how to help an object to delete itself the boost way
From: Ireneusz Szcześniak (irek.szczesniak_at_[hidden])
Date: 2015-12-17 15:15:04


Hi Ian,

Thanks for your email. I only wonder how an object should trigger its
deletion...

Best,
Irek

W dniu 17.12.2015 o 20:38, Ian Bruntlett pisze:
> Hi Ireneusz,
>
> Basically your class is a resource handle. If the constructor cannot
> complete, the accepted approach is to throw an exception.
>
> If a member function finishes the job and frees the resources, have
> that member function modify the object's member variables so the
> destructor can recognise that the resources have been freed and it
> doesn't need to do anything about those resources.
>
> This approach is called RAII and see this page:-
> https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
>
> BW,
>
>
> Ian
>
> --
> -- ACCU - Professionalism in programming - http://www.accu.org
> -- My writing - https://sites.google.com/site/ianbruntlett/
> -- Free Software page -
> https://sites.google.com/site/ianbruntlett/home/free-software
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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