|
Boost : |
From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-09-22 15:50:46
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Martin Bonner
> Sent: Friday, September 22, 2006 6:52 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Geometry/Vector Lib
>
> ----Original Message----
> From: Sohail Somani
>
> >
> > Marcus Lindblom wrote:
> >> I've sometimes done just:
> >>
> >> class vector3d
> >> {
> >> public:
> >> float x, y, z;
> >>
> >> float operator[]( int index ) const
> >> { return (&x)[index]; }
> >>
> >> /* ... */
> >> };
> > Won't that not work in the presence of padding?
> In theory, yes. In practice, I can't see why any compiler
> would bother
> adding such padding.
Theory is what holds the C++ world together! I wouldn't want to
knowingly invoke UB unless I can prove its worth my while (for example,
in the case of hardware specific optimizations).
Sohail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk