Subject: Re: [boost] [utility/value_init] boost::value_initialized<T> direct-initialized?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-04-08 12:38:02
Jeffrey Lee Hellrung, Jr. wrote:
> Stewart, Robert wrote:
> > Fernando Cacciola wrote:
> >> I can imagine myself explaining that "initialize<T> m(v)" does
> >> direct-initialization, then that, OTOH, "initialized<T> m;" does
> >> value-initialization, since there is no explicit
> >> initialization in this case.
> > Why does initialized<T> need to have a default constructor?
> Because if it wasn't default-constructible, why would you use
> it (when a
> T object would suffice)?
> The motivating example (I believe) is when you have a class member of
> type initialized<T>, and you want the default constructor of
> the class
> to value initialize the data member. (You also want a (const T&)
> constructor that direct intializes the data member; otherwise,
> value_initialized<T> would suffice.)
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).
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