[Development] Changing qreal to a float

BRM bm_witness at yahoo.com
Tue Feb 21 15:34:35 CET 2012


> From: Thiago Macieira <thiago.macieira at intel.com>

> On terça-feira, 21 de fevereiro de 2012 09.59.49, Marc Mutz wrote:
>>  A tangential question: should QRect be QBasicRect<int> (in which case 
> it
>>  would  probably have a class invariant of right()-left()==width() instead
>>  of width()-1 as now. If there is a plan to move to CRect semantics (not
>>  sure I'd like that), then keeping QRect and using QRectI = 
> QBasicRect<int>
>>  could do the trick.
> 
> QRect must have the same semantics as it has today. Whether we want to add a 
> *second* rectangle class with slightly different semantics, I'll leave up to 
> the implementor.
> 
> I'd rather it were part of the template. That means whoever is implementing 
> this template needs to add some magic for the logic for integers to be 
> different from the logic from FP.

Perhaps a template is not the best option?
Perhaps an abstract/virtual class that is derived from for the various classes would be better?
Each class could then have its own internal data instead.
Yes, it would mean a little more duplication in the code; but it would allow for the specialization of each class to its type.

$0.02

Ben



More information about the Development mailing list