So some thoughts:
std::shared_ptr<char[]> ptr(new char[100]);
should be a syntax error all by itself.- For whatever reason,
unique_ptr
was enabled to support thestd::unique_ptr<char[]>
syntax. Some of the rationale can be found here. - The
std::shared_ptr<T>::operator[]
call also doesn't work, becausestd::shared_ptr
does not implement it, onlystd::unique_ptr
does.