From ad9108c1dce16740d1ae172a7cbd9181ecbbbefd Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Mon, 18 Feb 2008 22:11:19 +0000 Subject: [PATCH] Fixed the assignment of value_initialized for T being a C-style array. (The previous version would trigger a compile error in this case.) [SVN r43308] --- include/boost/utility/value_init.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index 4845cfb..60879cf 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -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 #include +#include #include #include #include @@ -75,7 +76,9 @@ class value_initialized value_initialized & operator=(value_initialized const & arg) { - this->data() = static_cast( arg.data() ); + // Assignment is only allowed when T is non-const. + BOOST_STATIC_ASSERT( ! is_const::value ); + *wrapper_address() = static_cast(*(arg.wrapper_address())); return *this; }