On 10 March 2011 15:02, Johannes Singler wrote:
>
> Well, isn't it a bit ugly to define such a guard newly every time?

It's one of my favourite techniques, the type is local and has no
linkage, it should be nothing but a destructor call which is
guaranteed to happen when exiting that scope.

> In other places, parallel mode uses std::vector, but I guess this is
> actually also discouraged for internal use, since it adds the <vector>
> dependency.

I don't have a strong feeling either way - for this case where the
resource is just memory, std::vector would work fine.

The local RAII type is more useful when you have other resources to
clean up which need custom handling.

Reply via email to