Boost logo

Boost :

Subject: Re: [boost] [interprocess] default constructors
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-12-03 01:38:04


Ion Gaztañaga wrote:

> I think there is no overhead.

The overhead I'm talking about is that allowing an empty state in the
object might have a cost.

A simple example is that if you have a function release(resource&), that
releases a valid resource, and you want to wrap that resource using
RAII, you have to write the destructor as

if(!is_empty)
     release(res);

instead of simply

release(res);

So you need to maintain a boolean (size overhead) and perform a
branching (runtime overhead).

Usually, however, at least the size overhead can be eliminated since
there is a special resource value reserved for the null resource.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk