Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Missing quantity operator++, operator%
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2012-06-10 17:57:36


All,

On Thu, Jun 7, 2012 at 1:25 AM, Daryle Walker <darylew_at_[hidden]> wrote:
>> Date: Wed, 6 Jun 2012 21:33:14 -0600
>> From: Nathan Crookston
>
>> I'm in the process of switching my homegrown units system over to
>> boost units. Some operators which I'm missing are the modulus and the
>> pre and post increment operators.
> If you look at "++" and "--" as "x + 1" and "x - 1", then they don't make
> sense.  Put if you look at them as successor and predecessor, then they
> would make sense for any type where such ordering can be established.
> So, the operators should be supported, but call the inner type's version
> of those operators instead of causing a compile error (unless the inner
> type doesn't have those operators).

Agreed.

>> I haven't found anything regarding the modulus operator. My question
>> is, would a patch adding those operators be accepted?
>
> Hopefully.
>
<snip modulus definition>
> (I'm assuming that addition is also commutative.)  Note that quotients are
> unit-less scalars, while remainders have the same units as the main type
> (used for the divisor and dividend).

I agree with this also.

Pinging again in hopes that one of the units maintainers sees. . .

Thanks,
Nate


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net