|
Boost : |
Subject: Re: [boost] [qvm] Terseness of syntax etc.
From: Sam Kellett (samkellett_at_[hidden])
Date: 2015-12-10 10:54:41
On 10 December 2015 at 07:45, Emil Dotchevski <emildotchevski_at_[hidden]>
wrote:
> On Wed, Dec 9, 2015 at 10:48 PM, Vicente J. Botet Escriba <
> vicente.botet_at_[hidden]> wrote:
>
> > Le 10/12/2015 00:58, Emil Dotchevski a écrit :
> >
> >> On Wed, Dec 9, 2015 at 3:41 PM, Vicente J. Botet Escriba <
> >> vicente.botet_at_[hidden]> wrote:
> >>
> >> Isn't
> >>>
> >>> qvm::ref(v).XY()
> >>>
> >>> terse enough?
> >>>
> >>> Compared to (v,XY)?
> >>
> > The best is the enemy of the good.
> >
> > I requested if it is not terse enough.
> >
>
> This problem does not have a good solution in C++, any chosen operator has
> drawbacks. That said, I wouldn't support ref(v).X() for accessing the X
> element of a vector, or ref(v).XY() for swizzling.
what about ref(v)[xy]? wrapping the custom type in a ref call alleviates
the restriction against the () and [] operators.
or maybe: swizzle(v, xy)
i also wonder if this might be possible: ref(v)->xy assuming the xy is a
field in an enum that the operator-> returns. whether or not there's anyway
of intercepting that to actually do the swizzle though i'm not sure...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk