Index: boost/utility/value_init.hpp =================================================================== --- boost/utility/value_init.hpp (revision 49991) +++ boost/utility/value_init.hpp (working copy) @@ -8,6 +8,7 @@ // 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker // 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola // 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola +// 28 Nov 2008 (Fixed logical constness) // #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP @@ -90,18 +91,25 @@ wrapper_address()->wrapper::~wrapper(); } - T& data() const + T const & data() const { return wrapper_address()->data; } + T& data() + { + return wrapper_address()->data; + } + void swap(value_initialized & arg) { ::boost::swap( this->data(), arg.data() ); } - operator T&() const { return this->data(); } + operator T const &() const { return this->data(); } + operator T&() { return this->data(); } + } ; Index: libs/utility/value_init_test.cpp =================================================================== --- libs/utility/value_init_test.cpp (revision 48425) +++ libs/utility/value_init_test.cpp (working copy) @@ -260,7 +260,7 @@ boost::value_initialized const x_c ; BOOST_CHECK ( y == x_c ) ; BOOST_CHECK ( y == boost::get(x_c) ) ; - T& x_c_ref = x_c ; + T& x_c_ref = const_cast( boost::get(x_c) ) ; x_c_ref = z ; BOOST_CHECK ( x_c == z ) ;