Boost logo

Boost Users :

From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-05-20 09:04:06


Edward Diener wrote:
> I solved it in my template by having the data value for T be of type T
> when T is top-level const, otherwise it is boost::value_initialized<T>
> when T is not a top-level const. The mpl::if_ metafunction and
> boost::is_const were used to generate the correct type, ala
>
> mpl::if_<boost::is_const<T>,T,boost::value_initialized<T> >::type
> data;

Okay, so your data is either a T, or a value_initialized<T>. I was
wondering, do you use the fact that value_initialized<T> implicitly
converts to reference-to-T?

If your data is value_initialized<T>, you do boost::get(data) = arg.
Would it be helpful to you to have an extra (explicit)
boost::value_initialized<T> constructor, having const-reference to T as
argument?

Kind regards,

Niels


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net