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

Viewed 387

Even though, one can get away fine with boost.

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

I'd like to know why the C++17 standard doesn't provide std::make_shared<T[]> whereas it provides 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_ptr supports array types (as of C++17), but std::make_shared does not. This functionality is supported by boost::make_shared

allocate_shared and make_shared for arrays
http://www.boost.org/doc/libs/release/libs/smart_ptr/make_shared_array.html

0 Answers
Related