This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: embeded anonymous structs and unions...
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: "Gareth Pearce" <tilps at hotmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Tue, 18 Mar 2003 13:21:56 -0600
- Subject: Re: embeded anonymous structs and unions...
Hi Gareth,
Try this...
class Blah {
public:
double x,y,z;
double& operator [] (int i) { return (&x)[i]; }
};
Note: this is relying on the C++ behavior of laying out in memory the
variables as given. This is a typical (standard?) behavior of all the C++
compilers that I've used.
--Eljay