Boost logo

Boost :

Subject: Re: [boost] [utility/value_init] boost::value_initialized<T> direct-initialized?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-04-08 16:52:50


Niels Dekker wrote:
> Robert Stewart wrote:
> > Given that, I have to agree with Fernando that initialize is
> > merely a superset of value_initialize and can be harder to explain
> > unless it derives from value_initialize (even if it shares nothing
> > from the base and only makes clear that it is a superset).
>
> Thanks, Robert. But do you mean public inheritance? You know, I once
> considered having initialized<T> publicly derived from
> value_initialized<T>:
> http://lists.boost.org/Archives/boost/2010/03/164356.php But then I
> realized that it would imply that any "initialized" object is also a
> value_initialized object. While certainly an initialized
> object does not need to be value-initialized.

That is what I meant. A value_initialized object isn't stuck with its initialized value, is it? IOW, you can change the value later, at which point the object is no longer in a value-initialized state. Is that wrong? Is that a violation of the class' purpose? No. Likewise, an initialized instance allows for both forms of initialization; it is only concerned with some initialization having occurred. From value_initialized's standpoint, the object just has a value beyond what value-initialization would have given just as if an assignment had been done.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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