From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-02-24 19:24:54
David Abrahams wrote:
>> Everything seems already defined ;)
Every time I'm thinking about something, I find that it was already defined
>> Given the fact optional<>::m_storage is aligned like a bool...:
>> - 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.
> And if the object's constructor throws an exception, what then?
I am not familiar with exceptions that much, but calling implicitly the
object's destructor will not affect its construction if the user does not
forget to call its constructor. Doesn't it?
>> struct A
>> typedef optional_typelist< typelist<char, short, double> >
>> typedef array<bool, optional_members::size> optional_inits;
>> optional_inits init; // Array of booleans
>> optional_members storage; // Typelist storage
>> In this example, optional_typelist<T1, T2, T3, ...> would be a list
>> of optional<T1>, optional<T2>, optional<T3>, ...
>> It could be simplified even more, but this is just a suggestion.
> You're really a fiend for low-level optimizations, aren't you?
Yes, I'm trying to promote those optimizations whenever possible... Maybe
my example was too much ugly. Here is another one:
struct A : optionals<char, short, double>
new (optional<2>) double(3.1416);
Given that optionals<> is similar to a tuple<> and it will generate two
distinct lists: one list of booleans and another list of storage types.
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