Boost logo

Boost :

Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-08-29 12:08:28


On 08/28/13 10:37, Gottlob Frege wrote:
> On Wed, Aug 28, 2013 at 8:51 AM, Larry Evans <cppljevans_at_[hidden]>wrote:
>
>> On 08/27/13 23:51, Gottlob Frege wrote:
>>
>>> char * space = make_space_for_item(handler->size()); // make space in
>>> vector<char>
>>> handler->do_copy(space, item); inplace copy construct
>> How does make_space_for_item assure the return value is aligned
>> properly for an Item type?
>> [snip]
>>
>>
>>
> Well, I guess it would also need some kind of handler->alignment().
>
> make_space_for_item(handler->size(), handler->alignment());
>
> you would look at the end of the vector<char> and see if it aligns or how
> much you need to fudge there. So add enough for alignment + size and
> return the aligned address.
>
This "add enough for alignment+size" is what attachment to:

http://article.gmane.org/gmane.comp.lib.boost.devel/243575

does; however, that code doesn't have anything like a
handler->alignment() since all the information about
the alignment requirements can be gotten from the
Item template argument to the push_back member function.

HTH.

-Larry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk