> Is there any doc explaining how Janitor works?

I used the ultimate documentation (the source code) and found ...

> I'm using it like this:
>
> MyClass * myVar = NULL;
> Janitor<MyClass> j_myVar(myVar);
> j_myVar.release();
>
> try
> {
>     myVar = new MyClass();
>     j_myVar. <-- How to tell Janitor that var is now allocated and that
> it should release it?

... j_myVar.reset(myVar);

> }
> catch (...)
> {
>     //
> }

Note that when the previous value of the Janitor is not NULL, the storage
it points to is freed, before the new value (which defaults to NULL) is
assigned.

Jeroen.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to