From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-02-24 19:05:32
Fernando Cacciola (Home) wrote:
>> Well it depends on the platform but if sizeof(bool) == sizeof(int) on
> Were does this 'int' comes from?
sizeof(bool) may vary, you just don't know (1, 4, 8, ...). On Intel, if
sizeof(bool) == 4 == sizeof(int) optional<>::m_storage will be aligned to
the next integer boundary.
>> m_storage will be aligned to the next word boundary i.e. aligned
>> like an integer.
> Anyway, you just said that it depends on the platform, so I wouldn't
> that m_storage *is*
> aligned like bool, at most, it could be.
>>>> - Maybe aligned_storage<> should always destruct its object. It
>>>> would be the user's responsability to construct the object before
>>>> its destruction, otherwise the result would be undefined.
>>> Why would this be useful?
>> I don't know, it is just another alternative that I personally
> Why do you prefer this?
Because the main purpose of aligned_storage<> is to postpone its
construction? This means that it *must* be constructed sooner or later?
>>>> - Maybe we could create 2 separate type lists if optional<> is used
>>>> many times in the same object, gathering m_initialized types and
>>>> m_storage in separate lists:
>>> What for ?
>> I think bool arrays use bitfields
> Which bool arrays?
> bool x[..] ;
> maybe, but are less efficient in that case.
I guess boost::array<bool, size_t> is also optimized...?
Philippe A. Bouchard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk