Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-08-18 09:47:44


Reid Sweatman wrote:
>
> > Yes, and that is a very conscious design decision. These classes are
> > very low-level. So like built-in types, they don't default
> > initialize the value. Same rationale as for the built-in types.
> > Efficiency does count here. These things often appear in structs of
> > which huge buffer arrays for I/O are constructed, and we don't want
> > those initialized.
> >
> > Remember that bin/ubin are used almost exclusively for trafficking
> > with the outside world via some I/O mechanism.
> >
> > Now if lots of people complain, the initialization polity could
> > change. So people who think these classes should default initialize
> > should speak up! Otherwise they will stay the way they are.
> >
> > Thanks for bring this up; it is the kind of design decision that
> > needs to be widely exposed to the light of day. In general it is
> > certainly better to default initialize.
>
> How about including an initializer parameter that defaults to false, in the
> same manner as allocators in container constructors?

What do you mean exactly ?

The following ?

class foo
{public:
   foo (bool initialise) { if (initialise) value = 0; }
};

?

-- 
Valentin Bonnard

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