From -8856633324776139168
X-Google-Thread: f78e5,4176870a6d7b2d6
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!npeer.de.kpn-eurorings.net!proxad.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: skaller@nospam.com.au ("John Max Skaller")
Newsgroups: comp.std.c++
Subject: Re: Union fun
Date: Thu, 21 Oct 2004 01:56:12 GMT
Lines: 31
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <pan.2004.10.20.14.43.22.509411@nospam.com.au>
References: <pan.2004.10.17.15.08.58.192861@nospam.com.au> <slrncn71pm.fqi.ben-public-nospam@decadentplace.org.uk> <pan.2004.10.19.01.55.50.896756@nospam.com.au> <abefd130.0410191235.65eb5aa2@posting.google.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: news.demon.co.uk 1098323847 29102 158.152.254.254 (21 Oct 2004 01:57:27 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 21 Oct 2004 01:57:27 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Pan/0.13.3 (That cat's something I can't explain)
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i9L1uCEU010007;
	Thu, 21 Oct 2004 11:56:12 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:3124

On Tue, 19 Oct 2004 22:59:53 +0000, Peter Dimov wrote:

 
> TR1 includes aligned_storage<Len, Align>.

OK, thanks.

 You can use
> aligned_storage<sizeof(T), alignment_of<T>::value>::type to obtain a
> storage type for T. It can be implemented using Boost's type traits as
> follows:
> 
> template<size_t L, size_t A> struct aligned_storage
> {
>    union type
>    {
>       unsigned char data_[ L ];
>       typename boost::type_with_alignment<A>::type align_;
>    };
> };

Gak! That boost stuff is pretty tricky :)

OK, I think that might work. Thanks.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



