Ticket #5483: initialized-assignment-fix.patch
File initialized-assignment-fix.patch, 1.4 KB (added by , 12 years ago) |
---|
-
boost/utility/value_init.hpp
11 11 // 20 Feb 2009 (Fixed logical const-ness issues) Niels Dekker, Fernando Cacciola 12 12 // 03 Apr 2010 (Added initialized<T>, suggested by Jeffrey Hellrung, fixing #3472) Niels Dekker 13 13 // 30 May 2010 (Made memset call conditional, fixing #3869) Niels Dekker 14 // 17 Apr 2011 (Added operator=(<T>const&), fixing #5483) Christian Masloch 14 15 // 15 16 #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP 16 17 #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP … … 125 126 return *this; 126 127 } 127 128 129 initialized & operator=(T const & arg) 130 { 131 // Assignment is only allowed when T is non-const. 132 BOOST_STATIC_ASSERT( ! is_const<T>::value ); 133 *wrapper_address() = wrapper(arg); 134 return *this; 135 } 136 128 137 ~initialized() 129 138 { 130 139 wrapper_address()->wrapper::~wrapper(); … … 214 223 { 215 224 return m_data; 216 225 } 226 227 value_initialized & operator=(value_initialized const & arg) 228 { 229 // Assignment is only allowed when T is non-const. 230 BOOST_STATIC_ASSERT( ! is_const<T>::value ); 231 m_data = arg.m_data; 232 return *this; 233 } 234 235 value_initialized & operator=(T const & arg) 236 { 237 // Assignment is only allowed when T is non-const. 238 BOOST_STATIC_ASSERT( ! is_const<T>::value ); 239 m_data = arg; 240 return *this; 241 } 217 242 } ; 218 243 219 244