
8 Jul
2013
8 Jul
'13
4:13 a.m.
On Sun, Jul 7, 2013 at 8:27 PM, Andrey Semashev <andrey.semashev@gmail.com> wrote:
...or even shared_ptr< array<...> >?
One advantage of boost::shared_ptr<T[N]> p1; over shared_ptr<array<T, N>> p2; is that the former gives you p1[index] which is slightly nicer than (*p2)[index]. In the case of both, the size N is already known at compile time anyway since it is part of the type.
Why not simply use vector or shared_ptr< vector<...> >?
If what he really wants is a std::vector<T>, this is a good alternative. If not, he pays for a few things you may not use: e.g. one additional allocation compared to boost::shared_ptr<T[]>. Glen