Re: [Boost-bugs] [Boost C++ Libraries] #3472: Setting value_initialized<T> to a value when T is a top-level const

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3472: Setting value_initialized<T> to a value when T is a top-level const
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-01-06 09:51:44


#3472: Setting value_initialized<T> to a value when T is a top-level const
------------------------------------------------+---------------------------
 Reporter: Edward Diener <eld@…> | Owner: fcacciola
     Type: Feature Requests | Status: new
Milestone: Boost 1.41.0 | Component: utility
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: value_initialized const |
------------------------------------------------+---------------------------

Comment(by niels_dekker):

 Hi Edward,
 I understand you do not want to adapt your proposed constructor, merely
 because of a Microsoft specific compiler bug. But I think
 [https://svn.boost.org/trac/boost/attachment/ticket/3472/value_init.patch
 your patch] ''might'' break some use cases on other compilers as well:
 {{{
 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);
 }
 }}}

 The above example will become ambiguous when your proposed constructor is
 added, also according to GCC 4.1.2: http://codepad.org/zukxSDbB

 I think there's a trade off between safety and convenience here. BTW, why
 did you add an {{{explicit}}} keyword to your constructor?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3472#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC