Subject: Re: [boost] static_vector using aligned_storage
From: Nevin Liber (nevin_at_[hidden])
Date: 2012-12-18 02:15:35
On 17 December 2012 22:45, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]>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
> 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
Sounds like a bug. The standard is quite clear that data() returns a T*,
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk