Subject: Re: [boost] [utility/value_init] boost::value_initialized<T> direct-initialized?
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-04-08 12:30:03
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.)
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk