I wanted to replace some raw pointers in my class with a std::shared_ptr so that I don\'t have to worry when I create copies of that class. But the raw pointers
std::shared_ptr
If you specified the deleter then you don't use T[] in the template argument. Just change T[] to T:
T[]
T
template shared_ptr make_shared_array(size_t size) { return shared_ptr(new T[size], default_delete()); } struct Foo { shared_ptr field; };