-, make_shared ? .
Boost shared_ptr::operator[](...). boost::detail::sp_extent, ( T T[]). http://www.boost.org/doc/libs/1_63_0/boost/smart_ptr/shared_ptr.hpp:
namespace boost{
template<typename T>
class shared_ptr{
.....
typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const
{
BOOST_ASSERT( px != 0 );
BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) );
return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] );
}
....
}
namespace detail{
template< class T > struct sp_array_access
{ typedef void type; };
template< class T > struct sp_array_access< T[] >
{ typedef T & type; };
template< class T, std::size_t N > struct sp_array_access< T[N] >
{ typedef T & type; };
template< class T > struct sp_extent
{ enum _vt { value = 0 }; };
template< class T, std::size_t N > struct sp_extent< T[N] >
{ enum _vt { value = N }; };
}
}
-, sh_arr2 sh_arr3? int 30.
. Boost docs:
1.53 Boost, shared_ptr . (T [] T [N]) . , T [] , T [N]; [] .