Why doesn't C ++ 17 provide make_shared <T []>, while C ++ 17 shared_ptr provides the [] operator?

Despite the fact that you can do a great job with the promotion.

#include "boost/smart_ptr/make_shared_array.hpp"
auto int_arr_ptr = boost::make_shared<int[]>(100);

I would like to know why the C ++ 17 standard does not provide std::make_shared<T[]>, whereas how does it provide shared_ptr::operator[]?


std::shared_ptr::operator[] http://en.cppreference.com/w/cpp/memory/shared_ptr/operator_at

std::make_shared http://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared

  • std::shared_ptrsupports array types (as in C ++ 17), but std::make_sharedno. This functionality is supported.boost::make_shared

allocate_sharedand make_sharedfor arrays
http://www.boost.org/doc/libs/release/libs/smart_ptr/make_shared_array.html

+6

All Articles