To allocate a char* array I would normally write something like:
char* arr = new char[size];
How can I achieve the same thing using boost::shared_ptr (or probably boost::shared_array) and boost::make_shared?
My guesses are:
1) boost::shared_ptr<char[]> arr = boost::make_shared<char[]>(size);
2) boost::shared_ptr<char> arr = boost::make_shared<char>(size);
3) boost::shared_ptr<char> arr = boost::shared_ptr<char>(new char[size]);
The last one looks right but is it guaranteed that upon destruction delete [] arr will be called?