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? 回答1: Some people do not have the luxury of using std::vector , even with allocators. Some people need a dynamically sized array, so std::array is out. And some people get their arrays from other code that is known to return an array; and that code isn't going to be rewritten to