Ticket #4637: extra_scoped_array_constructor.patch
File extra_scoped_array_constructor.patch, 1.4 KB (added by , 12 years ago) |
---|
-
boost/smart_ptr/scoped_array.hpp
60 60 #endif 61 61 } 62 62 63 explicit scoped_array(std::size_t n) : px( n == 0 ? 0 : new T[n]() ) 64 { 65 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 66 boost::sp_array_constructor_hook( px ); 67 #endif 68 } 69 63 70 ~scoped_array() // never throws 64 71 { 65 72 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) -
libs/smart_ptr/test/smart_ptr_test.cpp
144 144 sa.reset(); 145 145 BOOST_TEST( sa.get() == 0 ); 146 146 147 std::size_t zero = 0; 148 BOOST_TEST( boost::scoped_array<char>(zero).get() == 0 ); 149 std::size_t two = 2; 150 boost::scoped_array<char> scoped_array_of_size_two(two); 151 BOOST_TEST( scoped_array_of_size_two[0] == '\0' ); 152 BOOST_TEST( scoped_array_of_size_two[1] == '\0' ); 153 scoped_array_of_size_two[1] = '1'; 154 BOOST_TEST( scoped_array_of_size_two[0] == '\0' ); 155 BOOST_TEST( scoped_array_of_size_two[1] == '1' ); 156 147 157 // test shared_ptr with a built-in type 148 158 int * ip = new int; 149 159 boost::shared_ptr<int> cp ( ip );