Ticket #3869: value_init_workaround.patch
File value_init_workaround.patch, 1.6 KB (added by , 12 years ago) |
---|
-
boost/utility/value_init.hpp
10 10 // 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola 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 // 16 May 2010 (Made memset call conditional, fixing #3869) Niels Dekker 13 14 // 14 15 #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP 15 16 #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP … … 21 22 // contains. More details on these issues are at libs/utility/value_init.htm 22 23 23 24 #include <boost/aligned_storage.hpp> 25 #include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION. 24 26 #include <boost/detail/workaround.hpp> 25 27 #include <boost/static_assert.hpp> 26 28 #include <boost/type_traits/cv_traits.hpp> … … 41 43 #endif 42 44 #endif 43 45 46 #ifndef BOOST_DETAIL_VALUE_INIT_WORKAROUND 47 #ifdef BOOST_NO_COMPLETE_VALUE_INITIALIZATION 48 #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 1 49 #else 50 #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0 51 #endif 52 #endif 53 44 54 namespace boost { 45 55 46 56 template<class T> … … 82 92 83 93 initialized() 84 94 { 85 // Note: the following memset call will become conditional when ticket #3869 is fixed: 86 // https://svn.boost.org/trac/boost/ticket/3869 reported by Aleksey Gurtovoy. 95 #if BOOST_DETAIL_VALUE_INIT_WORKAROUND 87 96 std::memset(&x, 0, sizeof(x)); 88 97 #endif 89 98 new (wrapper_address()) wrapper(); 90 99 } 91 100