This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
embeded anonymous structs and unions...
- From: "Gareth Pearce" <tilps at hotmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 18 Mar 2003 00:25:43 +0000
- Subject: embeded anonymous structs and unions...
- Bcc:
Hi,
I was wondering if there was someway to do the equivelent of what the
following code looks like...
class Blah
{
union
{
double coords[3];
struct
{
double x, y, z;
};
};
}
that is, put an anonymous struct inside an anonymous union...
I tried the above with g++ 3.4 20030314 - with no luck...
the above combined with an operator[] returning a reference to coords
elements
would allow
Blah c;
c.x = 1;
c.y = 1;
c.z = 1;
for (int i=0; i<3; i++)
std::cout << c[i] << std::endl;
to function.
Any clues?
Thanks,
Gareth
_________________________________________________________________
MSN Instant Messenger now available on Australian mobile phones.?Go to
http://ninemsn.com.au/mobilecentral/hotmail_messenger.asp