
On 17 December 2012 22:45, Adam Wulkiewicz <adam.wulkiewicz@gmail.com>wrote:
I assumed that in the allocated memory the hybrid_vector stores only elements exceeding the static storage. In this case it would store them in two different places - static storage and allocated one.
I hope not. One of the properties of vector is that the space is contiguous. If the current storage (whether embedded or allocated) capacity is exceeded, allocate new space, move-if-noexcept or copy the elements from the old space to the new space (say, via std::move_if_noexcept), then deallocate the old space if and only if it was originally allocated.
It would work, if after the static storage overflow and the first allocation, elements were moved to the newly allocated memory. I don't know however if this isn't too big penalty.
It isn't any different than the normal "penalty" for vector.
Yes I understand this. My question is regarding the case when data() returns Alloc::pointer (I believe this is the case in MS implementation).
Sounds like a bug. The standard is quite clear that data() returns a T*, not Alloc::pointer. -- Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> (847) 691-1404