Date: Fri, 07 Oct 2005 08:32:34 +0200
From: Joaqu?n M? L?pez Mu?oz < joaquin@tid.es>
Subject: Re: [Boost-users] aligned_storage / alignment_of       /
        type_with_alignment
To: boost-users@lists.boost.org
Message-ID: < 43461682.7A1C50F0@tid.es>
Content-Type: text/plain; charset=iso-8859-1

Gottlob Frege ha escrito:

This is *almost* correct. There's a typo in 1.33 Boost.TypeTraits docs
(corrected
in 1.33.1) by which the explanations on type_with_alignment and
aligned_storage
are swapped. So, what you want is

template <typename T>
struct uninitted
{
   aligned_storage<sizeof(T), alignment_of<T>::value>::type myT;

  void init_later(some_params)
  {
      new (&myT) T(some_params);
  }
};

Apart from this, your construct is OK and works as you expect. Actually,
this is
what aligned_storage is meant to be used for.
Best,

Joaqu?n M L?pez Mu?oz
Telef?nica, Investigaci?n y Desarrollo



OK, thanks.  By its name, I thought aligned_storage sounded like the right thing (and thus I included it in the subject line) but I wasn't sure how it fit in.

I think aligned_storage<sizeof(T), alignment_of<T>::value>::type deserves its own template - maybe 'storage_for' ?


Anyhow, I think I have everything I need, so away I go....

Tony