Boost logo

Boost :

Subject: Re: [boost] [qvm] Terseness of syntax etc.
From: Sam Kellett (samkellett_at_[hidden])
Date: 2015-12-10 11:10:36


On 10 December 2015 at 15:54, Sam Kellett <samkellett_at_[hidden]> wrote:

> [snip]
>>
> 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...
>

a couple more thoughts about this...

what namespace is your comma operator in? it could be placed in an extra
namespace which users can explicitly pull in if they prefer the super
compact (albeit controversial) syntax and then anybody else could stick
with a normal free function (like my swizzle(v, xy) above) which would be
in the normal qvm namespace


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