Re: [KUnitConversion] Question about overloading operators

2016-12-02 Thread Albert Astals Cid
El dimecres, 23 de novembre de 2016, a les 9:00:10 CET, Ander Pijoan va escriure: > So would it be to hamrfull to add at least this four operators? At the > moment just allowing same Unit values. You mentioned that using Q_ASSERT is > not a good idea, maybe there is another way of ensuring they ha

Re: [KUnitConversion] Question about overloading operators

2016-11-23 Thread Ander Pijoan
So would it be to hamrfull to add at least this four operators? At the moment just allowing same Unit values. You mentioned that using Q_ASSERT is not a good idea, maybe there is another way of ensuring they have the same unit. Value operator +(const Value &other) { Q_ASSERT( this->unit() == other

Re: [KUnitConversion] Question about overloading operators

2016-11-21 Thread Ander Pijoan
I wasn't expecting to have different Units operations and conversion at math operation. Just same Unit category math operations, now it is no possible to sum or subtract two VALUES whatever their unit is because the operator is not overloaded. Just to be able to do "10m" + "20m" which is not possi

Re: [KUnitConversion] Question about overloading operators

2016-11-21 Thread Albert Astals Cid
El dilluns, 21 de novembre de 2016, a les 18:00:18 CET, Christoph Feck va escriure: > On 21.11.2016 08:27, Ander Pijoan wrote: > > Value operator +(const Value &other) > > { > > > > Q_ASSERT( unit() == other.unit() ); > > return Value( number() + other.number() , unit() ); > > > >

Re: [KUnitConversion] Question about overloading operators

2016-11-21 Thread Albert Astals Cid
El dilluns, 21 de novembre de 2016, a les 8:27:11 CET, Ander Pijoan va escriure: > Hi Aleix, > > I think at least the most desirable basic feature would be to have the > math operators overloaded to be able to operate with Values. Something like > > > Value operator +(const Value &other) > { >

Re: [KUnitConversion] Question about overloading operators

2016-11-21 Thread Christoph Feck
On 21.11.2016 08:27, Ander Pijoan wrote: Value operator +(const Value &other) { Q_ASSERT( unit() == other.unit() ); return Value( number() + other.number() , unit() ); } So when adding "3 m" and "40 cm" you want to have an assert (that isn't compiled into code unless you are in d

Re: [KUnitConversion] Question about overloading operators

2016-11-21 Thread Milian Wolff
On Monday, November 21, 2016 8:27:11 AM CET Ander Pijoan wrote: > Hi Aleix, > > I think at least the most desirable basic feature would be to have the > math operators overloaded to be able to operate with Values. Something like > > > Value operator +(const Value &other) > { > Q_ASSERT( un

Re: [KUnitConversion] Question about overloading operators

2016-11-21 Thread Ander Pijoan
Hi Aleix, I think at least the most desirable basic feature would be to have the math operators overloaded to be able to operate with Values. Something like : Value operator +(const Value &other) { Q_ASSERT( unit() == other.unit() ); return Value( number() + other.number() , unit()

Re: [KUnitConversion] Question about overloading operators

2016-11-20 Thread Aleix Pol
On Fri, Nov 18, 2016 at 1:21 PM, Ander Pijoan wrote: > Hi all, > > First of all sorry if this email should be in another list. > > I have a small question about summing, subtracting, multiplying... Values. > I see that the operators have not been overloaded. Should we extend the > Value class and

[KUnitConversion] Question about overloading operators

2016-11-18 Thread Ander Pijoan
Hi all, First of all sorry if this email should be in another list. I have a small question about summing, subtracting, multiplying... Values. I see that the operators have not been overloaded. Should we extend the Value class and overload them or there is a more straightforward way of operating