Boost logo

Boost Users :

Subject: [Boost-users] [units] Missing quantity operator++, operator%
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2012-06-06 23:33:14


All,

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.

Looking through the archives I note an original review[1] which
mentioned the absence of those operators. One response claimed that
quantity<si::length, int> t = 5. ...; t++; was nonsensical as writing
5 m + 1, and the reviewer eventually agreed, citing possible confusion
if the quantity type converted the initializer. Matthias Schabel
seemed to respond favorably:

'I debated this for a while - the only problem is that there will be
some value types with heterogeneous operator+ / operator- for which q
+ 1 is not the same type as q, but I guess that it is just OK for it
to just give a compile error in those cases.'

And Steven Watanabe said 'Will do.'

I haven't found anything regarding the modulus operator. My question
is, would a patch adding those operators be accepted?

Thanks,
Nate

[1] http://lists.boost.org/Archives/boost/2007/03/119001.php


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