Boost logo

Boost :

From: John Femiani (JOHN.FEMIANI_at_[hidden])
Date: 2007-10-04 20:27:15


> Phil Endecott wrote:
> > Joel de Guzman wrote:
> >> Phil Endecott wrote:
> >>> * xyz or [n] notation: using .x, .y and .z to access the
coordinates
> >>> seems simpler to me, but the higher-dimension people would prefer
to
> >>> use [0], [1] ... [n]. That notation also has the advantage that
you
> >>> can iterate through the dimensions. Is it possible to support
both?
> >> Yes! Use fusion to do the mapping, making all your structs, arrays
or
> >> whatnots, whatever they are, compatible.
> >
> > I was imagining something more lightweight, like a union...
> >
> > There's also the possibility of simply defining implicit conversions
> > between the two styles.
> >
> > But a better solution would be to decide from the outset that one
style
> > is "right" and the other is "wrong", so only one needs to be
supported
> > and no conversions are needed. (I mean that partly
tongue-in-cheek.)
> >
>
> Have a look at:
>
> http://www.gamedev.net/community/forums/topic.asp?topic_id&1920
>
>
> - Michael Marcin
>

What is not lightweight about the get<0>(pt) syntax? Doesn't it compile
away? Is the issue a dependency on another library -- because the
get<0>(pt) syntax seems really easy to provide without bothering with
Fusion.

i.e.
template <int Index> float get(MyPoint & p) {return p[Index];}
OR
template <> float get<0>(MyPoint & p) {return p.x;}

-- John


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk