|
Boost-Commit : |
From: nielsdekker_at_[hidden]
Date: 2008-02-18 17:11:19
Author: niels_dekker
Date: 2008-02-18 17:11:19 EST (Mon, 18 Feb 2008)
New Revision: 43308
URL: http://svn.boost.org/trac/boost/changeset/43308
Log:
Fixed the assignment of value_initialized<T> for T being a C-style array. (The previous version would trigger a compile error in this case.)
Text files modified:
trunk/boost/utility/value_init.hpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
Modified: trunk/boost/utility/value_init.hpp
==============================================================================
--- trunk/boost/utility/value_init.hpp (original)
+++ trunk/boost/utility/value_init.hpp 2008-02-18 17:11:19 EST (Mon, 18 Feb 2008)
@@ -5,7 +5,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
// 21 Ago 2002 (Created) Fernando Cacciola
-// 30 Jan 2008 (Worked around compiler bugs, added initialized_value) Fernando Cacciola, Niels Dekker
+// 18 Feb 2008 (Worked around compiler bugs, added initialized_value) Fernando Cacciola, Niels Dekker
//
#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
@@ -18,6 +18,7 @@
#include <boost/aligned_storage.hpp>
#include <boost/detail/workaround.hpp>
+#include <boost/static_assert.hpp>
#include <boost/type_traits/cv_traits.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <cstring>
@@ -75,7 +76,9 @@
value_initialized & operator=(value_initialized const & arg)
{
- this->data() = static_cast<T const &>( arg.data() );
+ // Assignment is only allowed when T is non-const.
+ BOOST_STATIC_ASSERT( ! is_const<T>::value );
+ *wrapper_address() = static_cast<wrapper const &>(*(arg.wrapper_address()));
return *this;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk