Index: boost/smart_ptr/scoped_array.hpp =================================================================== --- boost/smart_ptr/scoped_array.hpp (revision 65353) +++ boost/smart_ptr/scoped_array.hpp (working copy) @@ -60,6 +60,13 @@ #endif } + explicit scoped_array(std::size_t n) : px( n == 0 ? 0 : new T[n]() ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_constructor_hook( px ); +#endif + } + ~scoped_array() // never throws { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) Index: libs/smart_ptr/test/smart_ptr_test.cpp =================================================================== --- libs/smart_ptr/test/smart_ptr_test.cpp (revision 65353) +++ libs/smart_ptr/test/smart_ptr_test.cpp (working copy) @@ -144,6 +144,16 @@ sa.reset(); BOOST_TEST( sa.get() == 0 ); + std::size_t zero = 0; + BOOST_TEST( boost::scoped_array(zero).get() == 0 ); + std::size_t two = 2; + boost::scoped_array scoped_array_of_size_two(two); + BOOST_TEST( scoped_array_of_size_two[0] == '\0' ); + BOOST_TEST( scoped_array_of_size_two[1] == '\0' ); + scoped_array_of_size_two[1] = '1'; + BOOST_TEST( scoped_array_of_size_two[0] == '\0' ); + BOOST_TEST( scoped_array_of_size_two[1] == '1' ); + // test shared_ptr with a built-in type int * ip = new int; boost::shared_ptr cp ( ip );