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-02 03:38:12


>> the example I added to the ticket (#3472) would also be ambiguous on
>> other compilers, when value_initialized(T const&) would be added:
>>
>> class my_integer
>> {
>> value_initialized<int> m_data;
>> public:
>> operator value_initialized<int>() const;
>> operator int() const;
>> };
>>
>> int main()
>> {
>> my_integer my;
>> value_initialized<int> val(my);
>> }
>>
>> See http://codepad.org/zukxSDbB

Steven Watanabe wrote:
> Um. Why do you /want/ to do this?

I don't know, it's just an example. my_integer::operator
value_initialized<int>() might do some extra checks that
my_integer::operator int() does not. Or whatever. You know,
boost::value_initialized<T> has been around for very long already, so I
think it's possible that adding a value_initialized(T const&)
constructor might break some legacy user code. But please let me know if
you have a better example!

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