|
Boost : |
Subject: Re: [boost] [aligned storage] support for empty storage
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-04-21 06:35:46
John Maddock skrev:
>> In case your are wondering, then I need this functionality in
>> boost::auto_buffer to get rid of the extra word when the stack-buffer
>> is empty (thus making auto_buffer as small as vector).
>>
>> Comments?
>
> I haven't looked into this in detail, but what happens on compilers that
> don't support the EBO?
>
Nothing AFAICT. All current uses of aligned_storage has an internal
buffer of size at least 1. Having a private data member or inherting
privately from a non-empty class should give the same results.
For compilers that don't support EBO, the size of an empty
aligned_storage will be > 0, but this is also the case when
we have an emty data member (at least with gcc).
However
void* address() const { return this; }
probably needs to be modified to return the address of the private base
class instead.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk