<div dir="ltr"><div><div><div><div>Hi Aleix,<br><br></div>I think at least the most desirable basic feature would be to have the <br>math operators overloaded to be able to operate with Values. Something like :<br><br>Value operator +(const Value &other)<br>{ <br> Q_ASSERT( unit() == other.unit() ); <br> return Value( number() + other.number() , unit() ); <br>}<br><br></div>At least to be able to operate with same Unit Values. <br>I have an application where I was calculating several routes. This week I started using KUnitConversion <br>Values for the length, max speed and price of each of each road segment, in order to explicitly<br></div>have the units "stored" within the value. But suddenly found I can't even sum two lengths because the<br></div>+ operator is not overloaded.<br><div><div><br>If further operations involving different units conversions want to be supported, probably some sort of <br>equivalence structures would need to be created, but I havent think much of it. I was just asking about single <br>Unit operations.<br><br></div><div>Cheers.<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-20 13:45 GMT+01:00 Aleix Pol <span dir="ltr"><<a href="mailto:aleixpol@kde.org" target="_blank">aleixpol@kde.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Nov 18, 2016 at 1:21 PM, Ander Pijoan <<a href="mailto:ander.pijoan@deusto.es">ander.pijoan@deusto.es</a>> wrote:<br>
> Hi all,<br>
><br>
> First of all sorry if this email should be in another list.<br>
><br>
> I have a small question about summing, subtracting, multiplying... Values.<br>
> I see that the operators have not been overloaded. Should we extend the<br>
> Value class and overload them or there is a more straightforward way of<br>
> operating with Values?<br>
><br>
> Thanks in advance.<br>
<br>
</span>Hi Ander,<br>
It's certainly tempting, I'm not sure how good it would work. Do you<br>
have some kind of proof of concept?<br>
It's something that sounds obviously good, but we need to make sure<br>
doesn't become a mess. Knowing what's the problems we'd find could be<br>
a good first approach.<br>
Also what's your use-case? :)<br>
<span class="HOEnZb"><font color="#888888"><br>
Aleix<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(68,68,68)"><font size="2"><span style="font-family:Arial;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Ander Pijoan </span></font></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(68,68,68)"><font size="2"><span style="font-family:Arial;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Research Assistant / DeustoTech Energía<br></span></font></span></p><span style="color:rgb(68,68,68)"><font size="2"><br></font></span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(68,68,68)"><font size="2"><span style="font-family:Arial;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Universidad de Deusto / Deustuko Unibertsitatea</span></font></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(68,68,68)"><font size="2"><span style="font-family:Arial;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Avda. Universidades 24. 48007 Bilbao</span></font></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(68,68,68)"><font size="2"><span style="font-family:Arial;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Tel. 94 413 90 03/ 2052<br></span></font></span></p><span style="color:rgb(68,68,68)"><font size="2"><span style="font-family:Arial;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><a href="mailto:ander.pijoan@deusto.es" target="_blank">ander.pijoan@deusto.es</a></span></font></span></div></div></div></div></div></div>
</div>