Boost logo

Boost :

Subject: Re: [boost] [utility/value_init] boost::value_initialized<T> direct-initialized?
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2010-04-08 12:03:14


Fernando Cacciola wrote:
> OK, only seven months after Eduard's inital request I finally made the
> time to really look at it :)

Thanks, Fernando! Sorry for snipping out large pieces of your reply.

> So I'd go for Eduard's patch.

For anyone else following this discussion, Eduard's patch, which adds
direct-initialization to boost::value_initialized<T>, is at
https://svn.boost.org/trac/boost/attachment/ticket/3472/value_init.patch

> So, let's just add the plain and simple explicit ctor :)
> [Neils, feel free to argue back :)

Okay, here I go: Suppose, a long time ago you wrote a class named
foo::const_iterator, which provides const access to foo's items. Now you
happen to need non-const access as well. Will you add this as an extra
feature to foo::const_iterator? I hope not. I hope, you'd rather write an
extra class, named foo::iterator.

Now we're having a template class named boost::value_initialized<T>, which
provides value-initialization. And we happen to need
non-value-initialization as well, as reported by #3472. I still believe an
extra boost::initialized<T> template class is the best choice. As was
suggested by Jeff:
https://svn.boost.org/trac/boost/attachment/ticket/3472/initialized.patch

Kind regards,

  Niels

--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center 

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