+ 1
Issue of shared_ptr array
Please refer code below and help me understand issue in code : Issue is last line where I have created array of shared pointer using make shared.... If I use unique pointer and make_unique for array , it works https://code.sololearn.com/coUjtrYcaZEY/?ref=app
1 Odpowiedź
+ 1
Prior to C++20, there was no template specialization of std::make_shared<>() for array types:
https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared
Since the playground currently has C++17 enabled, the parameter is instead forwarded to the class constructor, but no such constructor exists.
It works with std::make_unique<>() because the necessary specialization for arrays exists since C++14.