$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-04-20 00:44:15
Fernando Cacciola wrote:
> Currently, optional<> is using its own aligned_storage
> template, but this is because I've found that the
> aligned_storage as it was designed for both optional
> and variant ICEed BCB5 on some particular cases,
> so I had to provide a custom template; but I intend
> to find a 'general' version of aligned_storage that
> can be used by optional and variant at the same time.
> 
>> There will be a specialization
>> for the case where the padding is non-zero and the flag is placed
>> in the padding and another specialization for the case where padding
>> is zero and the flag is a data member. Generic accessor member
>> functions can be provided: bool is_initialized() const, void
>> is_initialized(bool f); 
>> 
> We might come to conclude that the 'initialized' flag is approptiate
> even 
> for a general 'aligned_storage' facility. In this case,
> I think your technique will work.
In fact, it might be tempting to use the other bits as well.
For example, I'd imagine a variant implementation that uses
8 bits to flag the currently active type. I imagine this interface:
    template <class T>
    class aligned_storage
    {
        public:
    
        void const*     address() const;
        void*           address();
    
        unsigned char   tag() const;
        void            tag(unsigned char data);
    };
-- Joel de Guzman joel at boost-consulting.com http://www.boost-consulting.com http://spirit.sf.net