Do you need the allocated memory to be shared? You can use a std::unique_ptr
instead and the std::make_unique
available on C++14:
auto buffer = std::make_unique<char[]>(64);
There will be a std::make_shared
version available in C++20:
auto buffer = std::make_shared<char[]>(64);