Re: [boost] Yet Another Container: DynamicArray
I wrote:
Yes quite. i.e. What you believe is not true about boost::allocate_unique.
i.e. For auto p = boost::allocate_unique
(a, n); assert(p.get().size() == n); This is because the unique_ptr stores a pointer adaptor around the Allocator::pointer which also stores the size.
So the pointer and size are stored together in the unique_ptr result.
Note, that the size is only stored for allocate_unique
To get the plain Allocator::pointer out of it you can use p.get().ptr()
Or, for example, p.release().ptr() for someone who wants to manage it themselves.
Glen
participants (1)
-
Glen Fernandes