Boost logo

Boost :

Subject: Re: [boost] Review Request: QVM (generic Quaternion, Vector and Matrix operations library)
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2015-06-26 04:42:05


On Fri, Jun 26, 2015 at 12:57 AM, Sam Kellett <samkellett_at_[hidden]> wrote:

> > On Thu, Jun 25, 2015 at 9:35 PM, Michael Marcin <mike.marcin_at_[hidden]>
> > wrote:
> >
> > > I love swizzling although I dislike this particular syntax.
> > >
> >
> > See http://zajo.github.io/boost-qvm/operator_mod_rationale.html.
> > Basically,
> > I can't think of a better alternative.
>
> What about
>
> v['x'] *= 42;
> v['yxz'] = 42;
>

1) Character constants containing more than one character are
implementation-defined (not portable).

2) The swizzling dispatch must be done at compile-time. You couldn't do
this with an int argument to operator[].

3) operator[] must be a member function, and QVM operations work on
user-defined types. You can, of course, define operator[] in your own types
in terms of operator% from QVM.

So we're stuck with:

v%X *= 42;
v%YXZ *= 42;

-- 
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode

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