|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-08 11:16:58
----- Original Message -----
From: "Howard Hinnant" <hinnant_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, March 08, 2002 11:03 AM
Subject: Re: [boost] Re: container design (Was: std::complex design
(Was: N-Dimensional array))
> On Friday, March 8, 2002, at 10:33 AM, David Abrahams wrote:
>
> >> What problem does this solve that vector<T>(n, uninitialized_flag)
> >> doesn't solve?
> >
> > Using uninitialized_flag allows people to make vectors with broken
> > invariants, and the invariants stay broken for an arbitrary amount
of
> > time. The memory adoption suggestion keeps the vector invariants
intact,
> > assuming that the user doesn't lie to the vector when she tells it
to
> > adopt (and that's just the usual danger that the user must not break
her
> > end of the contract).
> >
> > I think that's a big advantage, assuming that the other needs are
met.
>
> Sorry to be dense, but what vector invariant is broken?
Oh, for example, that the vector can be copied or destroyed or the 0th
item can be dereferenced, depending on the definition of T and what you
think uninitialized_flag actually does.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk