Boost logo

Boost Users :

Subject: Re: [Boost-users] how to help an object to delete itself the boost way
From: Ian Bruntlett (ian.bruntlett_at_[hidden])
Date: 2015-12-17 14:38:35

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:-



-- ACCU - Professionalism in programming -
-- My writing -
-- Free Software page -

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at