Fernando Cacciola wrote:

[...]

>> Given the fact optional<>::m_storage is aligned like a bool...:
>>
> It is not aligned like a bool...

Well it depends on the platform but if sizeof(bool) == sizeof(int) on Intel,
m_storage will be aligned to the next word boundary i.e. aligned like an
integer.

>> - 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 prefer.

>> - 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 to store their values and optional_members
types could be properly aligned.



Philippe A. Bouchard




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to