Boost logo

Boost :

Subject: Re: [boost] [optional] memory use for optional refs and ptrs
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-10-07 07:37:35


On 10/06/10 13:59, Larry Evans wrote:
> On 10/06/10 13:33, Rutger ter Borg wrote:
> [snip]
>> Is there some
>> kind of facility that is able to point to "padding space" in aligned
>> structures? (perhaps a facility of the alignment stuff in boost)?
>>
> [snip]
> There's:
>
>
> https://svn.boost.org/trac/boost/browser/sandbox/variadic_templates/boost/composite_storage/alignment/aligned_offset.hpp
>
[snip]

A more complete facility use is here:

https://svn.boost.org/trac/boost/browser/sandbox/variadic_templates/libs/composite_storage/sandbox/layout_all.cpp

which produces output:

mpl::size<result_t>=3
( size=1, align=1)
( size=4, align=4)
( size=8, align=8)
composition
< offset=8
, size=16
, align=8
>
padding_one=0
padding_all=0
composition
< offset=4
, size=8
, align=4
>
padding_one=3
padding_all=3
composition
< offset=0
, size=1
, align=1
>
padding_one=0
padding_all=3
layout0
< size=0
, align=1
>

which shows the padding after the char is 3 in order
to make the alignment of the int at 4.

HTH.

-Larry


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