Quick Q: Why use the array form of unique_ptr? -- StackOverflow

Enquiring minds want to know: Why use unique_ptr<T[]> vs. vector<T> vs. array<T>?

Is there any use for unique_ptr with array?

std::unique_ptr has support for arrays, for instance:

 

std::unique_ptr<int[]> p(new int[10]);

but is it needed? probably it is more convenient to use std::vector or std::array.

Do you find any use for that construct?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.